On 18/02/13 16:10, Petr Pudlák wrote: > - `foldr` is unsuitable because it counts the elements from the end, > while `!!` needs counting from the start (and it's not tail recursive).
It is common misconception that foldr processes the list "from the right". foldr "brackets" from the right, but this has nothing to do with processing direction; all [a] are processed left to right, since this is the only way to structurally deconstruct them. This is the reason why it is possible to write foldr (:) [] [1..] If foldr processed the list from the right, it would on infinite lists - and it does. _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe