On 02/05/12 01:04, Asranz wrote:
Hello so i got this problem agian i have been trying to resolve it
with macros but i dont get the idea.
i just need to evaluate in infix a string "(1 +2 (4 * 5)" but dont
get it to do it with macros the part of changing the string type.
Thanks,
I can help you only if you're trying to evaluate an infix list like: (1
+ 2 * 4 * 5)
notice how this is not a string, it has no nested parens and it will not
handle operator precedence.
In other words i can show you how to do the transformation from infix to
prefix. If you want to do the fancy stuff you need to write a couple of
helper functions...if i remember correctly the incanter source has an
"equation" macro that goes the whole way...however i'm not sure how to
do that on a string...there must be a way to parse the string as a list
assuming of course the thing inside quotes starts and ends with
opening/closing paren respectively...
Jim
--
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