On 26/04/12 19:15, Asranz wrote:
Hi tahnks!
   i just need to do that operation. to conbert that string. for
example for sums i did
(defn sum [s]
     (apply + (map #(- (int (first %)) (int \0)) (re-seq #"[0-9]" s))))
and it just sums the the numbers but if a have also multiplications,
substracyions and divsions how i do it??

You need to rethink your approach...If you want to transform a piece of code you can't really do so without macros...otherwise your argument (the infix expression) will be evaluated before your function is even called - yielding compile error (cos it is not understandable from clojure's point of view)...

Jim

ps:also i'm pretty sure you don't need regex for something like this....you're just making your life difficult!

--
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