[Haskell-cafe] Parse text difficulty

Ben Rudiak-Gould Benjamin.Rudiak-Gould at cl.cam.ac.uk
Fri Dec 10 12:56:36 EST 2004

Henning Thielemann wrote:

 >I try to stay away from list comprehension because I can't memorize in
 >which order the conditions are processed [...]

I remember it as being slowest-changing-to-the-left, just like the 
positional notation for integers. E.g.

    [[x,y] | x <- ['1'..'4'], y <- ['0'..'9']]

will give you the numbers from 10 to 49 in order (as strings).

Another way to remember is that it's the same order as its equivalent 
using the list monad:

    do { x <- ['1'..'4']; y <- ['0'..'9']; return [x,y] }

-- Ben

More information about the Haskell-Cafe mailing list