Guest User

Untitled

a guest
Oct 23rd, 2014
281
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1.  
  2. Exercise 13
  3.  
  4. 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.
  5.  
  6. Hint: use let to avoid pain
  7.  
  8. (add-author little-schemer {:name "Gerald J. Sussman"})
  9. ;=> {:title "The Little Schemer"
  10. ; :authors [{:birth-year 1944, :name "Daniel Friedman"}
  11. ; {:name "Matthias Felleisen"}
  12. ; {:name "Gerald J. Sussman"}]}
  13. (add-author {:authors [{:name "Juhana"}]} {:name "Jani"})
  14. ;=> {:authors [{:name "Juhana"} {:name "Jani"}]}
Advertisement
Add Comment
Please, Sign In to add comment