Hi,

On Jan 8, 3:10 pm, tristan <tristan.k...@gmail.com> wrote:
> I've been working on a problem where I want the user to be able to
> input an equation in infix notation which includes variables and
> convert that to a clojure fn that my program can call later.

You need to construct the form of the function explicitely and call
eval on that. (Why is already explained by Laurent)

(defn create-user-function
  [inputs body]
  (eval `(fn ~inputs ~...@body)))

(apply create-user-function (parse input))

Random notes:
1. You may want to use vectors w/ conj and peek instead of lists w/
reverse and first.
2. Please don't write macros with "(list 'foo (vec bar) baz)". Always
use syntax-quote aka `

Sincerely
Meikel
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to