Created
October 20, 2014 21:48
-
-
Save adam-e-trepanier/47866b5d0a8045d87561 to your computer and use it in GitHub Desktop.
Destructuring with :key directive
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; 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