summaryrefslogtreecommitdiffhomepage
path: root/haskell.html.markdown
diff options
context:
space:
mode:
authorNiko Weh <niko.weh@gmail.com>2015-10-31 19:44:04 +1000
committerNiko Weh <niko.weh@gmail.com>2015-10-31 19:44:04 +1000
commitb5cb14703ac99e70ecd6c1ec2abd9a2b5dbde54d (patch)
treed2d8a0061b7c8a34dc51ffc981d63903349f5ce3 /haskell.html.markdown
parentedfc99e198fd2e87802ea81d6779fbadfab64919 (diff)
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 !!).
Diffstat (limited to 'haskell.html.markdown')
-rw-r--r--haskell.html.markdown2
1 files changed, 1 insertions, 1 deletions
diff --git a/haskell.html.markdown b/haskell.html.markdown
index 08611e63..936744a0 100644
--- a/haskell.html.markdown
+++ b/haskell.html.markdown
@@ -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