[Haskell-beginners] Open-ended list comprehension

martin martin.drautzburg at web.de
Wed Mar 25 17:51:48 UTC 2015


Hello all,

when I write my own recursions, I often end up with something like

a : b : c : (f x)

where f x returns a list. I assume this avoids the costly (++) function, right?

But when I use list comprehensions I always get a complete list and it is costly to append something to it. How can I
use the power of list comprehensions, but return an [a]->[a] instead of an [a]?

Is this a good idea at all, or will I pile up thunks?





More information about the Beginners mailing list