문제

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top