Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save amalloy/1231002 to your computer and use it in GitHub Desktop.
Save amalloy/1231002 to your computer and use it in GitHub Desktop.
;; amalloy's solution to Universal Computation Engine
;; https://4clojure.com/problem/121
(fn [formula]
(fn [values]
((fn compute [x]
(if (seq? x)
(let [[op & args] x]
(apply ({'+ + '/ / '- - '* *} op)
(map compute args)))
(get values x x)))
formula)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment