From 36a296de5d8d82212755ba33388517486f7f804c Mon Sep 17 00:00:00 2001 From: Zach Munro-Cape Date: Sun, 1 Mar 2015 15:16:29 -0400 Subject: Moved explanation of indexing into a list earlier This way, it is clear what [1..] !! 999 means later on. --- haskell.html.markdown | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'haskell.html.markdown') diff --git a/haskell.html.markdown b/haskell.html.markdown index 52433aaa..79fbf09f 100644 --- a/haskell.html.markdown +++ b/haskell.html.markdown @@ -80,6 +80,9 @@ not False -- True [5..1] -- This doesn't work because Haskell defaults to incrementing. [5,4..1] -- [5, 4, 3, 2, 1] +-- indexing into a list +[0..] !! 5 -- 5 + -- You can also have infinite lists in Haskell! [1..] -- a list of all the natural numbers @@ -99,9 +102,6 @@ not False -- True -- adding to the head of a list 0:[1..5] -- [0, 1, 2, 3, 4, 5] --- indexing into a list -[0..] !! 5 -- 5 - -- more list operations head [1..5] -- 1 tail [1..5] -- [2, 3, 4, 5] -- cgit v1.2.3