>> Is one solution more efficient than the other?  I believe my solution is 
>> tail recursive, but it's my understanding that compilers can now 
>> optimize just about anything into tail recursion.

>The first solution works for infinite lists and the second one does not. 

I don't see how that's possible.  Both traversals seem to be limited by n, and 
therefore they do not have to touch the end of the list.  In any case, it would 
seem to me that the *first* solution would be the one that wouldn't work on an 
infinite list.  Can you explain?


>It's really like foldr vs. foldl.

Hmm...I never thought of foldr and foldl in those terms.  Thanks.

I'l be sure to post any other questions I have on the beginner list.





_______________________________________________
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell

Reply via email to