http://www.the-magus.inOn Wed, Jan 30, 2013 at 5:32 PM, Junior White <efiish@gmail.com> wrote:
Thanks for your reply! I must learn more to fully understand what's going on inside the list comprehension.But when I frist learn Haskell, it says sequence doesn't matter, but now it is a big matter, can compiler do some thing for us? I think this behavior is not friendly to newbies like me, I will take a very long time to work through it.
Good point. Being a programmer means having to juggle many hats -- two important ones being the mathematician-hat and the machine-hat, also called declaration and 'imperation' Get only the first and your programs will run very inefficiently. Get only the second and your program will have bugs.
Specifically in the case of list comprehensions the newbie needs
- to practice thinking of the comprehension like a set comprehension and ignoring computation sequences
- to practice thinking of comprehension in terms of map/filter etc ie operationally
Both views are needed.
Rusi
--
http://blog.languager.org