Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
12
Task/Call-a-function/Clojure/call-a-function-5.clj
Normal file
12
Task/Call-a-function/Clojure/call-a-function-5.clj
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
(defn make-mailing-label [{:keys [name address country]}]
|
||||
"Returns the correct text to mail a letter to the addressee"
|
||||
(str name "\n" address "\n" (or country "UK"))) ;; If country is nil, assume it is the UK
|
||||
|
||||
;; We can call it with all three arguments in a map to get mickey's international address
|
||||
(make-mailing-label {:name "Mickey Mouse"
|
||||
:address "1 Disney Avenue, Los Angeles"
|
||||
:country "USA"}); => "Mickey Mouse\n1 Disney Avenue, Los Angeles\nUSA"
|
||||
|
||||
;; Or we can call it with fewer arguments for domestic mail
|
||||
(make-mailing-label {:name "Her Majesty"
|
||||
:address "Buckingham Palace, London"}); => "Her Majesty\nBuckingham Palace, London\nUK"
|
||||
Loading…
Add table
Add a link
Reference in a new issue