@@ -102,26 +102,27 @@ Using `sy`:
102102[n=11 l={} r={22 33 44 55}]
103103
104104> `(set @)`c
105−{11 22 33 44 55}
105+{11 22 55 33 44}
106106
107107> =c `(set @)`c
108108```
109+Note that Dojo does not necessarily print elements of a set in the same order they were given. Mathematically speaking, sets are not ordered, so this is alright. There is no difference between two sets with the same elements written in a different order. Try forming `c` with a different ordering and check this.
109110
110111And we can add an item to the set using `put` of `in`:
111112
112113```
113114> (~(put in c) 77)
114−[n=11 l=~ r=[n=77 l={22 33 44 55} r={}]]
115+[n=11 l={} r={22 77 55 33 44}]
115116
116117> `(set @)`(~(put in c) 77)
117−{11 22 33 44 55 77}
118+{11 22 77 55 33 44}
118119```
119120
120121You can remove items using `del` of `in`:
121122
122123```
123124> (~(del in c) 55)
124−[n=11 l=~ r=[n=33 l={22} r={44}]]
125+[n=11 l={} r={22 33 44}]
125126
126127> `(set @)`(~(del in c) 55)
127128{11 22 33 44}
@@ -140,17 +141,16 @@ You can apply a gate to each item of a set using `run` of `in` and produce a new
140141
141142```
142143> c
143−{11 22 33 44 55}
144+{11 22 55 33 44}
144145
145146> (~(run in c) |=(a=@ +(a)))
146−{12 23 34 45 56}
147+{56 45 23 12 34}
147148```
148−
149149You can also apply a gate to all items of the set and return an accumulated value using `rep` of `in`:
150150
151151```
152152> c
153−{11 22 33 44 55}
153+{11 22 55 33 44}
154154
155155> (~(rep in c) add)
156156b=165
@@ -160,24 +160,24 @@ The standard library also has the union and intersection functions for sets:
160160
161161```
162162> c
163−{11 22 33 44 55}
163+{11 22 55 33 44}
164164
165165> =d `(set @)`(sy ~[33 44 55 66 77])
166166
167167> d
168−{33 44 55 66 77}
168+{66 77 55 33 44}
169169
170170> (~(int in c) d)
171−[n=33 l={} r={44 55}]
171+[n=33 l=[n=55 l={} r={}] r=[n=44 l={} r={}]]
172172
173173> `(set @)`(~(int in c) d)
174−{33 44 55}
174+{55 33 44}
175175
176176> (~(uni in c) d)
177−[n=11 l={} r={22 33 44 55 66 77}]
177+[n=11 l=[n=66 l={} r={}] r=[n=33 l={22 77 55} r={44}]]
178178
179179> `(set @)`(~(uni in c) d)
180−{11 22 33 44 55 66 77}
180+{66 11 22 77 55 33 44}
181181```
182182
183183It may be convenient to turn a set into a list for some operation and then operate on the list. You can convert a set to a list using `tap` of `in`:
@@ -187,14 +187,14 @@ It may be convenient to turn a set into a list for some operation and then opera
187187{11 22 33 44 55}
188188
189189> ~(tap in c)
190−~[55 44 33 22 11]
190+~[44 33 55 22 11]
191191```
192192
193193There are other set functions in the Hoon standard library we won't cover here.
194194
195195### Cartesian Product
196196
197−Here's a program that takes two sets of atoms and returns the Cartesian product of those sets. A Cartesian product of two sets `a` and `b` is a set of all the cells whose head is a member of `a` and whose tail is a member of `b`.
197+Here's a program that takes two sets of atoms and returns the [Cartesian product](https://en.wikipedia.org/wiki/Cartesian_product) of those sets. A Cartesian product of two sets `a` and `b` is a set of all the cells whose head is a member of `a` and whose tail is a member of `b`.
198198
199199```
200200|= [a=(set @) b=(set @)]
@@ -219,24 +219,24 @@ Save this as `cartesian.hoon` in your urbit's pier and run in the dojo:
219219> =c `(set @)`(sy ~[1 2 3])
220220
221221> c
222−{1 3 2}
222+{1 2 3}
223223
224224> =d `(set @)`(sy ~[4 5 6])
225225
226226> d
227−{5 4 6}
227+{5 6 4}
228228
229229> +cartesian [c d]
230−{[1 5] [1 4] [1 6] [3 5] [3 4] [3 6] [2 5] [2 4] [2 6]}
230+{[2 6] [1 6] [3 6] [1 4] [1 5] [2 4] [3 5] [3 4] [2 5]}
231231```
232232
233233## Maps
234234
235−Use `map` to create a set of key-value pairs, e.g., `(map @tas *)` for a set of `@tas` and `*` pairs. The `@tas` value serves as the 'key', which is a mechanism for tagging or naming the value, `*`. They key of each key-value pair is unique; every value in a map gets its own unique name.
235+Use `map` to create a set of key-value pairs, e.g., `(map @tas *)` for a set of `@tas` and `*` pairs. The `@tas` value serves as the 'key', which is a mechanism for tagging or naming the value, `*`. The key of each key-value pair is unique; every value in a map gets its own unique name.
236236
237237One example use case is for storing customer information as a set of pairs: `(map [employee-name employee-data])`.
238238
239−The `by` core in the Hoon standard library contains the various functions for operating on maps. Many of these functions are similar to the set functions of the `in` core. See the standard library reference documentation for maps [here](/docs/reference/library/2i/). As was the case with sets, the underlying noun of each map is a tree.
239+The `by` core in the Hoon standard library contains the various functions for operating on maps. Many of these functions are similar to the set functions of the `in` core. See the standard library reference documentation for maps here [here](/docs/reference/library/2i/). As was the case with sets, the underlying noun of each map is a tree.
240240
241241Two common methods for populating a map include (1) creating it from a list of key-value cells using the `my` function, and (2) inserting items into a map using the `put` arm of the `by` core.
242242
@@ -246,36 +246,36 @@ Using `my`:
246246> =c (my ~[[%one 1] [%two 2] [%three 3]])
247247
248248> c
249−[n=[p=%two q=2] l={[p=%three q=3] [p=%one q=1]} r={}]
249+[n=[p=%one q=1] l={[p=%two q=2]} r={[p=%three q=3]}]
250250
251251> =c `(map @tas @)`c
252252
253253> c
254−{[p=%three q=3] [p=%one q=1] [p=%two q=2]}
254+{[p=%two q=2] [p=%one q=1] [p=%three q=3]}
255255```
256256
257257We can add a key-value pair with `put` of `by`:
258258
259259```
260260> (~(put by c) [%four 4])
261−[n=[p=%two q=2] l={[p=%three q=3] [p=%four q=4] [p=%one q=1]} r={}]
261+[n=[p=%one q=1] l={[p=%four q=4] [p=%two q=2]} r={[p=%three q=3]}]
262262
263263> `(map @tas @)`(~(put by c) [%four 4])
264−{[p=%three q=3] [p=%four q=4] [p=%one q=1] [p=%two q=2]}
264+{[p=%four q=4] [p=%two q=2] [p=%one q=1] [p=%three q=3]}
265265```
266266
267267Delete a key-value pair with `del` of `by`, keeping in mind that you only need to pick the key of the pair to be deleted:
268268
269269```
270270> `(map @tas @)`(~(del by c) %two)
271−{[p=%three q=3] [p=%one q=1]}
271+{[p=%one q=1] [p=%three q=3]}
272272```
273273
274274You can produce the value of a key-value pair using `get` of `by` on the key:
275275
276276```
277277> (~(get by c) %two)
278−[~ u=2]
278+[~ 2]
279279```
280280
281281This result may be unexpected. Why didn't it just give us `2`? The answer has to do with the possibility that a requested key may not be in the map. For example:
@@ -287,7 +287,7 @@ This result may be unexpected. Why didn't it just give us `2`? The answer has
287287
288288Because there is no `%chicken` key in `c`, `get` simply returns `~` to indicate it's not in the map. Otherwise it returns a pair like the one you see in the next to last example.
289289
290−`get` of `by` returns the key's value as a `unit`, not as raw data. There are two kinds of `unit`s: null `~`, and non-null. A non-null `unit` is a pair of `[~ u=value]`. Unit types are constructed the way list, set, and map types are; for example, `(unit @)` is the type for a unit whose value is an atom.
290+`get` of `by` returns the key's value as a `unit`, not as raw data. There are two kinds of `unit`s: null `~`, and non-null. A non-null `unit` is a pair of `[~ value]`. Unit types are constructed the way list, set, and map types are; for example, `(unit @)` is the type for a unit whose value is an atom.
291291
292292If you want to get some key value without producing a unit, use `got` instead:
293293
@@ -297,7 +297,7 @@ If you want to get some key value without producing a unit, use `got` instead:
297297
298298> (~(got by c) %chicken)
299299####
300−ford: build failed
300+ford: %ride failed to execute:
301301```
302302
303303Use `has` of `by` to see whether a certain key is in the map:
@@ -314,9 +314,10 @@ You can use `run` of `by` to apply a gate to each value in a map, producing a ma
314314
315315```
316316> (~(run by c) |=(a=@ (mul 2 a)))
317−{[p=%three q=6] [p=%one q=2] [p=%two q=4]}
317+{[p=%two q=4] [p=%one q=2] [p=%three q=6]}
318318```
319319
320320There are other map functions in the Hoon standard library that didn't cover here.
321321
322322### [Next Up: <placeholder>]
323+