defining (-> Bool) as a set

Hal Daume III hdaume@ISI.EDU
Tue, 23 Apr 2002 11:17:48 -0700 (PDT)


Yeah, I realized that right after I sent the email (I was composing "on
the fly" and not copy-and-pasting).

I think the main reason I wrote it as an explicit lambda expression rather
than just single = (==) was because I wanted it to parallel the other
definitions.  IMO, the preferred way to write it would have been "single x
= \y -> x == y; I think "single = (==)" is much more difficult to
understand at first glance.  Doesn't really matter though; presumably the
compiler would fix all of this :).

--
Hal Daume III

 "Computer science is no more about computers    | hdaume@isi.edu
  than astronomy is about telescopes." -Dijkstra | www.isi.edu/~hdaume

On Tue, 23 Apr 2002, Christian Sievers wrote:

> Hal Daume III wrote:
> 
> > I'd like to be able to define something like
> 
> >   single x = \y -> if x == y then True else False
> 
> Just a note on style: it always hurts me to see something like
> 
>   if term then True else False
> 
> -- this is just the same as 'term'.
> 
> So you could say
> 
>   single x = \y -> x==y
> 
> which is in turn just the same as
> 
>   single x = (x==)
> 
> which is, amazingly, nothing more than
> 
>   single = (==)
> 
> -- one can debatte whether this is still better style than the first variant,
> but it's surely interesting to realize.
> 
> 
> All the best,
> Christian Sievers
>