Similar Haskell list comprehensions with different results
haskell, list-comprehension
Solution
It has to do with the fact that
enumFromThenTo 1.0 3.0 0.0
evaluates to `[1.0]`. The specification of `enumFromThenTo` for Floats can be found in section 6.3.4 of http://www.haskell.org/onlinereport/haskell2010/haskellch6.html .
Problem
I don't understand why these two similar list comprehensions give different results: ``` Prelude> let t2s n= [ 1/(2*i) | i <- [1,3..n]] Prelude> t2s 0 [0.5] Prelude> let t2s n= [ (2*i) | i <- [1,3..n]] Prelude> t2s 0 [] ``` I expected both to return `[]` on argument `0`. I must be missing something silly?!