Why are [1..5] returning to Rascal [1,2,3,4]?

I expect it to return [1,2,3,4,5], as in Haskell.

+4
source share
1 answer

The short answer is: the left pointer is on, and the right is solely for design.

Long answer: the reason for the short answer is that lists zero are indexed, and we noticed that everyone should write (or forget to write) [0..size(myList) - 1] . Now we can write [0..size(myList)] . This is not like Haskell, but like Python.

+7
source

Source: https://habr.com/ru/post/1500695/


All Articles