[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Read this one!!!



Date: 30 May 91 10:57
From: haskell-request@cs.glasgow.ac.uk
Sender: Nick North <ndn@seg.national-physical-lab.co.uk>
To: haskell@cs.glasgow.ac.uk
Subject: Re:  Read this one!!!

Original-Via: uk.ac.ukc; Thu, 30 May 91 10:47:58 BST

> | 2.  Auxiliary bindings in list comprehensions 
> | ========================================= 
> |
> | The additional form 
> | 
> | 	pat = exp 
> | 
> | for list comprehension qualifiers (besides generators and filters) was 
> | suggested a while back.  This could have the same meaning as 
> | 
> | 	pat <- [exp] 
> | 
> | This extension is much easier to live without, but it can make a lot 
> | list comprehensions more comprehensible, including many in the Prelude.  
> 
> 
> No technical problems here.  Main stylistic objection is that
> it looks quite like a guard.  Consider
> 
> 	[e | x <- xs, y <- ys, x= y]
> and	[e | x <- xs, y <- ys, x==y]
> 
> Sadly, both will type check (if x has the same type as y), if you write
> the former meaning the latter you will get strange results indeed!

I agree absolutely with the stylistic objection - anyone who has ever
programmed in C will have horror stories about confusion between = and ==.
Everyone (or at least I) will write = for == sometime in any large program,
and I would like the language to protect me from that.

  Nick North

BABYL OPTIONS: