Skip to content

Instantly share code, notes, and snippets.

@adam-e-trepanier
Created October 20, 2014 21:48
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 adam-e-trepanier/47866b5d0a8045d87561 to your computer and use it in GitHub Desktop.
Save adam-e-trepanier/47866b5d0a8045d87561 to your computer and use it in GitHub Desktop.
Destructuring with :key directive
;; Destructor a map with another map -> patient has a shipping address
;; We use the :keys directive to to assign the shipping address info inside of data
;; Notice we also use the :keys directive to also get the name and date of birth
(let [{:keys [name date-of-birth orders]
{:keys [street city state postal-code]} :shipping-address
:as patient} data]
(println name \- date-of-birth)
(println street ", " city ", " state " " postal-code)
(println orders)
(println "------- Full Patient Deatils -----")
(println patient))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment