Skip to content

Instantly share code, notes, and snippets.

@uggds
Last active September 6, 2015 07:00
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 uggds/ffe085c6da2e8b4511e7 to your computer and use it in GitHub Desktop.
Save uggds/ffe085c6da2e8b4511e7 to your computer and use it in GitHub Desktop.
(defn make-greeter [greeting-prefix]
(fn [username] (str greeting-prefix ", " username)))
(def hello-greeting (make-greeter "Hello"))
(hello-greeting "world")
-> "Hello, world"
(def aloho-greeting (make-greeter "Aloha"))
(aloha-greeting "world")
-> "Aloha, world"
((make-greeter "Hello") "world")
-> "Hello, world"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment