Re: Weird nested macro problem

2011-02-02 Thread Meikel Brandmeyer
Hi, On 2 Feb., 08:44, Ken Wesson kwess...@gmail.com wrote: This also means that macros should not use list? to test whether an object is a nonatomic s-expression. Unfortunately core doesn't contain a compact test for atomicity; to get all the list-y things that print as (foo bar baz ...) you

Re: Weird nested macro problem

2011-02-02 Thread Straszheim, Jeff
Thanks. That is indeed what fixed it! And macroexpand (and pr in general) should have an option to mark what is a list and what is a cons thingy. That is confusing. On Feb 2, 2011, at 1:48 AM, George Jahad wrote: As usual, Meikel has the right answer. But I didn't quite get it at first.

Re: Weird nested macro problem

2011-02-02 Thread Ken Wesson
On Wed, Feb 2, 2011 at 3:22 AM, Meikel Brandmeyer m...@kotka.de wrote: Hi, On 2 Feb., 08:44, Ken Wesson kwess...@gmail.com wrote: This also means that macros should not use list? to test whether an object is a nonatomic s-expression. Unfortunately core doesn't contain a compact test for

Weird nested macro problem

2011-02-01 Thread Straszheim, Jeff
So, I have a macro that looks something like this: (defmacro test-failure [ forms] `(handler-case :type ~@forms (~'handle :error/error (println error happened (My real macro is more complex, but this gives the idea.) If I eval (test-failure (println test)) I get:

Re: Weird nested macro problem

2011-02-01 Thread jweiss
If I remember right from looking at clojure.contrib.condition's source (which I did because I wrote a similar error handling lib, which has a few extra features but isn't ready for prime time)... handle doesn't actually exist as a function or macro. It doesn't expand - the handler-case macro

Re: Weird nested macro problem

2011-02-01 Thread Meikel Brandmeyer
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

Re: Weird nested macro problem

2011-02-01 Thread George Jahad
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

Re: Weird nested macro problem

2011-02-01 Thread Ken Wesson
On Wed, Feb 2, 2011 at 1:48 AM, George Jahad cloj...@blackbirdsystems.net wrote: 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))