Haskell: Fix !! operator

- Use a finite list, as infinite lists are not introduced yet
- Use a list starting from 1 instead of 0, to make it obvious that
  the element returned comes from the list (and is not the second
  argument to !!).
This commit is contained in:
Niko Weh 2015-10-31 19:44:04 +10:00
parent edfc99e198
commit b5cb14703a

View File

@ -81,7 +81,7 @@ not False -- True
[5,4..1] -- [5, 4, 3, 2, 1]
-- indexing into a list
[0..] !! 5 -- 5
[1..10] !! 3 -- 4
-- You can also have infinite lists in Haskell!
[1..] -- a list of all the natural numbers