[Haskell-beginners] Need some understanding on this behavior.
alexander at klink.name
Mon Feb 3 08:59:47 UTC 2020
On Mon, Feb 03, 2020 at 09:14:24AM +0100, Alexander Chen wrote:
> I need some understanding on the following behavior:
> a = [1..]
> [x | x <-a, x <= 100]
> (note the missing ']' which results in the command not finishing)
It does not finish because the list comprehension does not know that a
is ordered, so it has to go through *every* element and take those that
are less than or equal to 100.
More information about the Beginners