Created
April 9, 2014 21:04
-
-
Save PatrickMcDonald/10315738 to your computer and use it in GitHub Desktop.
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
(ns week1.core | |
(:gen-class)) | |
(defn -main | |
"I don't do a whole lot ... yet." | |
[& args] | |
(println "Hello, World!")) | |
(defn sum-x | |
"desc" | |
[x] | |
(reduce + x)) | |
(def lived ["Womb" "Dublin" "Charlotte, NC" "Dublin"]) | |
(def andrea | |
{:first "Andrea" | |
:last "Mag" | |
:hometown "Dublin" | |
}) | |
(def patrick {:first "Patrick" :last "McDonald" :hometown "Dublin"}) | |
(def us [patrick andrea]) | |
(defn format-name | |
[first last] | |
(str last "," first)) | |
(defn average | |
[numbers] | |
(let [sum (reduce + numbers) | |
n (count numbers)] | |
(/ sum n))) | |
(defn format-a-person | |
[person] | |
(format-name (:first person) (:last person))) | |
(defn get-names | |
[people] | |
(map format-a-person people)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment