Skip to content

Instantly share code, notes, and snippets.

@sli
Created July 19, 2016 22:39
Show Gist options
  • Save sli/01cc480972ccd7a4fc444782c4ab4ded to your computer and use it in GitHub Desktop.
Save sli/01cc480972ccd7a4fc444782c4ab4ded to your computer and use it in GitHub Desktop.
Figuring out Lisp by implementing partials in hy.
(defn partial [f arg &rest args1]
(defn p [&rest args2]
(apply f (+ (list* arg (list args1)) (list args2)))))
(defn add [a &rest b]
(+ a (reduce + b)))
(def add10 (partial add 10))
(print (add10 15 20))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment