Merge branch 'we-build-dreams/patch-1' into elm/en2

This commit is contained in:
Max Goldstein 2015-12-13 13:35:17 -05:00
commit ac2bff249e

View File

@ -76,13 +76,13 @@ snd ("elm", 42) -- 42
-- Records are like tuples but the fields have names. The order of fields -- Records are like tuples but the fields have names. The order of fields
-- doesn't matter. Notice that record values use equals signs, not colons. -- doesn't matter. Notice that record values use equals signs, not colons.
{ x = 3, y = 7} { x = 3, y = 7 }
-- Access a field with a dot and the field name. -- Access a field with a dot and the field name.
{ x = 3, y = 7}.x -- 3 { x = 3, y = 7 }.x -- 3
-- Or with an accessor fuction, which is a dot and the field name on its own. -- Or with an accessor fuction, which is a dot and the field name on its own.
.y { x = 3, y = 7} -- 7 .y { x = 3, y = 7 } -- 7
-- Update the fields of a record. (It must have the fields already.) -- Update the fields of a record. (It must have the fields already.)
{ person | { person |
@ -131,7 +131,7 @@ case List.head aList of
multiply a b = multiply a b =
a * b a * b
-- Apply (call) a function by passing it arguments (no commas necessay). -- Apply (call) a function by passing it arguments (no commas necessary).
multiply 7 6 -- 42 multiply 7 6 -- 42
-- Partially apply a function by passing only some of its arguments. -- Partially apply a function by passing only some of its arguments.
@ -173,7 +173,7 @@ fib n =
else else
fib (n - 1) + fib (n - 2) fib (n - 1) + fib (n - 2)
List.map fib [0..8] -- [1, 1, 2, 3, 5, 8,13, 21, 34] List.map fib [0..8] -- [1, 1, 2, 3, 5, 8, 13, 21, 34]
-- Another recursive function (use List.length in real code). -- Another recursive function (use List.length in real code).
listLength aList = listLength aList =