Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@yedi
Last active December 14, 2015 03:59
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 yedi/5024984 to your computer and use it in GitHub Desktop.
Save yedi/5024984 to your computer and use it in GitHub Desktop.
(-> (:user_id (get-cur-user request))
db/get-cart-items
(partial map
#(assoc %1
:cart_item
(db/get-dress (:cart_item_id %1)))) ;; breaks here, I want to take the maps from get-cart-items and returns
maps where cart-item is a key in map, and a dress from db is the value.
(fetched using the cart-item-id from the map)
json/write-str)
;; java.lang.Exception: Don't know how to write JSON of class clojure.core$partial$fn__4072
;; ========= how come the above throws an error, but the followin works?
(def pull-dress
(partial map
#(assoc %1
:cart_item
(db/get-dress (:cart_item_id %1)))))
(-> (:user_id (get-cur-user request))
db/get-cart-items
pull-dress
json/write-str)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment