Skip to content

Instantly share code, notes, and snippets.

@timvisher
Created April 25, 2013 21:59
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 timvisher/5463574 to your computer and use it in GitHub Desktop.
Save timvisher/5463574 to your computer and use it in GitHub Desktop.
(loop [expression [[[1 + 3] * 7] + [[[[3 - 1] / [1 + 3]] * 8]]]]
(if (vector? expression)
(recur (clojure.walk/prewalk try-calc-simple-expression expression))
expression))
;; => 32N
(loop [expression (read-string "[[[1 + 3] * 7] + [[[[3 - 1] / [1 + 3]] * 8]]]")]
(if (vector? expression)
(recur (clojure.walk/prewalk try-calc-simple-expression expression))
expression))
;; => 8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment