summaryrefslogtreecommitdiffhomepage
path: root/purescript.html.markdown
diff options
context:
space:
mode:
authorZachary Ferguson <zfergus2@users.noreply.github.com>2015-10-07 23:46:13 -0400
committerZachary Ferguson <zfergus2@users.noreply.github.com>2015-10-07 23:46:13 -0400
commitbc212592497b8e6277ba27a1c81a55eee3ad4c23 (patch)
tree54b9600f90ab7643cf67cc839ee1fb253788d695 /purescript.html.markdown
parente1ac6209a8d3f43e7a018d79454fb1095b3314c0 (diff)
parentabd7444f9e5343f597b561a69297122142881fc8 (diff)
Merge remote-tracking branch 'adambard/master'
Conflicts: java.html.markdown
Diffstat (limited to 'purescript.html.markdown')
-rw-r--r--purescript.html.markdown12
1 files changed, 6 insertions, 6 deletions
diff --git a/purescript.html.markdown b/purescript.html.markdown
index 6bff7545..a006cdff 100644
--- a/purescript.html.markdown
+++ b/purescript.html.markdown
@@ -70,12 +70,12 @@ true && (9 >= 19 || 1 < 2) -- true
-- Safe access return Maybe a
head [1,2,3] -- Just (1)
-tail [3,2,1] -- Just ([2,1])
+tail [3,2,1] -- Just ([2,1])
init [1,2,3] -- Just ([1,2])
last [3,2,1] -- Just (1)
-- Random access - indexing
[3,4,5,6,7] !! 2 -- Just (5)
--- Range
+-- Range
1..5 -- [1,2,3,4,5]
length [2,2,2] -- 3
drop 3 [5,4,3,2,1] -- [2,1]
@@ -129,10 +129,10 @@ first :: [Number] -> Number
first (x:_) = x
first [3,4,5] -- 3
second :: [Number] -> Number
-second (_:y:_) = y
+second (_:y:_) = y
second [3,4,5] -- 4
sumTwo :: [Number] -> [Number]
-sumTwo (x:y:rest) = (x+y) : rest
+sumTwo (x:y:rest) = (x+y) : rest
sumTwo [2,3,4,5,6] -- [5,4,5,6]
-- sumTwo doesn't handle when the array is empty or just have one
@@ -161,7 +161,7 @@ ecoTitle {title: "The Quantum Thief"} -- Object does not have property author
-- Lambda expressions
(\x -> x*x) 3 -- 9
-(\x y -> x*x + y*y) 4 5 -- 41
+(\x y -> x*x + y*y) 4 5 -- 41
sqr = \x -> x*x
-- Currying
@@ -187,7 +187,7 @@ foldr (+) 0 (1..10) -- 55
sum (1..10) -- 55
product (1..10) -- 3628800
--- Testing with predicate
+-- Testing with predicate
any even [1,2,3] -- true
all even [1,2,3] -- false