On 02/05/12 21:33, Aaron Cohen wrote:
(if-not (empty? (filter #(list? %)) '~expr))
This looks suspicious. filter is being called with 1st parameter anon
function, and no second parameter. How does that compile?
I apologise for the typo...it was originally (filter (fn [k] (list? k))
'~expr)
and i changed it to an anonymous function just for the email and forgot
the closing paren of fn ...NIce catch!it should be:
----------------------------------------------------------------------------------------------------
(defmacro infix-to-prefix [expr]
(if-not (empty? (filter #(list? %) '~expr))
(infix-to-prefix
(map #(if (list? %)
(apply (functionize infix-to-prefix) %) %) 'expr))
`(loop [
ops# (filter #(not (number? %)) '~expr)
args# (filter #(number? %) '~expr)
]
(if (empty? ops#) (first args#)
(let [[a# b# & more#] args#]
(recur
(rest ops#)
(conj more#
(list (first ops#) a# b#))))))))
----------------------------------------------------------------------------------------------------------------
--
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