As usual, Meikel has the right answer. But I didn't quite get it at
first.
It looks like syntax-quote generates cons's, not lists:
user> (type (nth `(handler-case :type (println "test") (~'handle foo))
3))
clojure.lang.Cons
Your macroexpand-1 example worked because the reader doesn't
distinguish between cons's and lists.
Because handler-case is expecting a list and syntax-quote won't
generate one, you'll have to write your macro like this:
(defmacro test-failure
[& forms]
`(handler-case :type
~@forms
~(list 'handle :error/error
'(println "error happened"))))
Finally, a shameless plug: you could have used the cdt, or debug-repl
to set a break around line 92 and figure it out yourself. That's what
I did.
On Feb 1, 2:31 pm, Meikel Brandmeyer <[email protected]> wrote:
> Hi,
>
> the failing part is actually not the comparison of the symbols, but the check
> for listness.
>
> user=> (list? (nth `(handler-case :type (println "test") (~'handle foo)) 3))
> false
> user=> (seq? (nth `(handler-case :type (println "test") (~'handle foo)) 3))
> true
>
> Sincerely
> Meikel
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en