On Fri, Jan 8, 2010 at 9:10 AM, tristan <tristan.k...@gmail.com> wrote:
>
> At first I thought I had solved it, as calling (parse-infix "a*(b+c)")
> returned the desired function that i could call. However as soon as i
> attempted to use it in the form (parse-infix users-input) it falls
> over with a "Don't know how to create ISeq from: clojure.lang.Symbol"
> error (examples in code at the bottom of the above file). I have
> fallen victim here to my own lack of understanding of macros. I now
> understand my folly and have a better understanding of how macro
> expansion works, however now I'm stuck as to how to solve this
> problem.

I think you're very close.  Having code that takes a string and
returns a anonymous fn form is good, but as you noticed having
that code in a macro doesn't seem to be what you want.  Because
you're starting with a user-supplied string, you are going to
need to use 'eval'.

Perhaps try chaning parse-infix to be a fn instead of a macro,
but still have it return (list 'fn ...etc).

Then (eval (parse-infix ...)) to get an actual fn object that you
can call repeatedly.

--Chouser
-- 
-- I funded Clojure 2010, did you?
-- 
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