summaryrefslogtreecommitdiffhomepage
path: root/haskell.html.markdown
diff options
context:
space:
mode:
authorDevin McGinty <devin.lee.mcginty@gmail.com>2015-01-31 19:51:09 -0500
committerDevin McGinty <devin.lee.mcginty@gmail.com>2015-01-31 19:51:09 -0500
commit9bf5a408f49e2e36658ef80538999052d5b1860f (patch)
tree8bfbe6fbeb597765e3e752aa2e8f7c81f5f66e0b /haskell.html.markdown
parent177adaa5a545670a31ae674906c660f6f462d679 (diff)
parent5f45319d577e1ef8a0d28f08fd37a7ed76433958 (diff)
Merge pull request #1 from devinmcginty/devinmcginty-patch-1
Add more information on ranges in Haskell
Diffstat (limited to 'haskell.html.markdown')
-rw-r--r--haskell.html.markdown10
1 files changed, 9 insertions, 1 deletions
diff --git a/haskell.html.markdown b/haskell.html.markdown
index 748a29da..d5dd5141 100644
--- a/haskell.html.markdown
+++ b/haskell.html.markdown
@@ -67,10 +67,18 @@ not False -- True
----------------------------------------------------
-- Every element in a list must have the same type.
--- Two lists that are the same
+-- These two lists are the same
[1, 2, 3, 4, 5]
[1..5]
+-- Ranges are versatile.
+['A'..'F'] -- "ABCDEF"
+
+-- You can create a step in a range.
+[0,2..10] -- [0, 2, 4, 6, 8, 10]
+[5..1] -- This doesn't work because Haskell defaults to incrementing.
+[5,4..1] -- [5, 4, 3, 2, 1]
+
-- You can also have infinite lists in Haskell!
[1..] -- a list of all the natural numbers