I expect it to return [1,2,3,4,5] as in Haskell.
Short answer: the left index is inclusive and the right is exclusive by design.
Long answer: the reason for the short answer is that lists are zero indexed, and we noticed everybody having to write (or forgetting to write) [0..size(myList) - 1]
. Now we can write [0..size(myList)]
instead. It is not like Haskell, but its like Python.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With