Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Exercise 13
- Use assoc and conj to write the function (add-author book new-author) that takes a book and an author as a parameter and adds author to books authors.
- Hint: use let to avoid pain
- (add-author little-schemer {:name "Gerald J. Sussman"})
- ;=> {:title "The Little Schemer"
- ; :authors [{:birth-year 1944, :name "Daniel Friedman"}
- ; {:name "Matthias Felleisen"}
- ; {:name "Gerald J. Sussman"}]}
- (add-author {:authors [{:name "Juhana"}]} {:name "Jani"})
- ;=> {:authors [{:name "Juhana"} {:name "Jani"}]}
Advertisement
Add Comment
Please, Sign In to add comment