Skip to content

Instantly share code, notes, and snippets.

@PatrickMcDonald
Created April 9, 2014 21:04
Show Gist options
  • Save PatrickMcDonald/10315738 to your computer and use it in GitHub Desktop.
Save PatrickMcDonald/10315738 to your computer and use it in GitHub Desktop.
(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