Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (defrecord Item [id name description])
- (def items
- (ref [
- (->Item "1" "Cookies" "Good tasting!")
- (->Item "2" "Blueberries" "Healthy!")
- ])
- )
- (dosync (commute items ???? ))
- (commute items #(remove (fn [x](= (:id x) id)) %))
- (nth (filtered (filter #(= (:id %) id) @items)) 0)
- (dosync
- (commute items
- #(mapv (fn [i]
- (if (= (:id i) "1")
- (assoc i :name "foo")
- i))
- %)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement