May 2018
Beginner to intermediate
290 pages
6h 43m
English
No matter how you create your record instances, once you have them in hand you can treat them just like maps with keyword keys:
| | (:name elizabeth) ; => "Elizabeth Bennet" |
| | (:appears-in watson) ; => "Sign of the Four" |
The resemblance between records and maps is much more than skin- (or keyword?) deep: Any function that works with a map will also work with a record:
| | (count elizabeth) ; => 3 |
| | (keys watson) ; => (:name :appears-in :author) |
You can also use assoc to modify the values in your record:
| | (def specific-watson (assoc watson :appears-in "Sign of the Four")) |
You can even assoc brand-new, not-in-the-record-type keys into your record instances:
| | (def more-about-watson (assoc watson :address "221B Baker Street" ... |
Read now
Unlock full access