Skip to content

Instantly share code, notes, and snippets.

@DeLaGuardo
Created October 22, 2019 12:26
Show Gist options
  • Save DeLaGuardo/bae97fb7da8619cbd78796ac24119256 to your computer and use it in GitHub Desktop.
Save DeLaGuardo/bae97fb7da8619cbd78796ac24119256 to your computer and use it in GitHub Desktop.
Lambda analyze
{:paths ["."]}
(ns lambda)
(defmacro memoize [lambda]
`(let [mem-fn# (memoize
(fn ~(vec (cons 'mem-fn (nth lambda 2)))
(let [~(nth lambda 1) (fn ~(nth lambda 2)
~(concat (list 'mem-fn 'mem-fn) (nth lambda 2)))]
~@(drop 3 lambda))))]
(partial mem-fn# mem-fn#)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment