2 ms·
> (The [0..10] is actually syntax, and I think that's quite unfortunate. `range 0 10` would have been just as good.) Well, Haskell is in fact flexible enough t
by eru 3y ago
> (The [0..10] is actually syntax, and I think that's quite unfortunate. `range 0 10` would have been just as good.)
Well, Haskell is in fact flexible enough that you can define that range function.
But one reason to make it syntax is that you can define things like [0..], which would be between awkward to impossible to do with a single `range` function in Haskell.
- tome 3y agoYes, indeed they are both functions, enumFromTo and enumFrom! https://www.stackage.org/haddock/lts-22.22/base-4.18.2.1/Prelude.html#v:enumFrom https://www.stackage.org/haddock/lts-22.22/base-4.18.2.1/Pre... https://www.stackage.org/haddock/lts-22.22/base-4.18.2.1/Prelude.html#v:enumFromTo https://www.stackage.org/haddock/lts-22.22/base-4.18.2.1/Pre...