Skip to content

Instantly share code, notes, and snippets.

@ericdwhite
Created February 18, 2014 20:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ericdwhite/9079003 to your computer and use it in GitHub Desktop.
Save ericdwhite/9079003 to your computer and use it in GitHub Desktop.
(ns user)
; The empty room
(def room {:id "room1" :people []})
; People to add to the room
(def p1 {:id 1 :name "john"})
(def p2 {:id 2 :name "sam"})
; Adding people to the room
(defn join-rm [room person]
(let [people (:people room)]
(merge room {:people (merge people person)})))
(def room' (join-rm room p1))
(join-rm room' p2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment