File tree Expand file tree Collapse file tree 1 file changed +10
-21
lines changed
Expand file tree Collapse file tree 1 file changed +10
-21
lines changed Original file line number Diff line number Diff line change 55type Dict k v = List (k, v)
66
77
8- OrdMap [k1 => v2, k2 => v2, ..., kn => vn]
8+ val x = Map.new [k1 => v2, k2 => v2, ..., kn => vn]
99
1010
1111-- Dictionary is a hash-map
1212
1313type Person =
14- { name :: String
15- age :: Int
14+ { name :: String,
15+ age :: Int,
1616 city :: City }
1717
18- dylan :: Person =
19- { name => "Bob Dylan"
20- age => 32
21- city => `London }
22-
23- dylan :: Person =
24- { name = "Bob Dylan"
25- age = 32
18+ val dylan :: Person =
19+ { name = "Bob Dylan",
20+ age = 32,
2621 city = `London }
2722
28- dylan :: Person =
29- { name: "Bob Dylan"
30- age: 32
31- city: `London }
32-
33- || There are also structural run-time types (row polymorphism) that do not
34- || require type definition.
23+ -- There are also structural run-time types (row polymorphism) that do not
24+ -- require type definition.
3525
3626p1 = { `x => 231, `y => 500 }
3727
@@ -40,8 +30,7 @@ p1 = { `x => 231, `y => 500 }
4030coordinate = `x => 23
4131
4232
43- people |> fold init: [] do (name => person) ->
44-
45- end
33+ people_by_name
34+ |> fold (acc (name, p) -> [p.age & acc]) []
4635
4736
You can’t perform that action at this time.
0 commit comments