I expect it to return [1,2,3,4,5] as in Haskell.
Asked
Active
Viewed 378 times
4
-
1The manual says it should be inclusive: http://www.meta-environment.org/doc/books/analysis/rascal-manual/rascal-manual.html#id1142539 http://tutor.rascal-mpl.org/Rascal/Rascal.html#/Rascal/Expressions/Values/Range/Range.html – Rup Sep 05 '13 at 10:06
-
thanks! the manual is out of date. Will fix. – Jurgen Vinju Sep 05 '13 at 10:53
-
manual was fixed in the meantime. – Jurgen Vinju Oct 30 '13 at 18:33
1 Answers
9
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.

Jurgen Vinju
- 6,393
- 1
- 15
- 26