From: Leslie P. Polzer
Subject: How does a quoted symbol become a CONS?
Date: 
Message-ID: <30bcc5c4-371f-456d-ba7f-d6c4ae90602a@j20g2000hsi.googlegroups.com>
Sorry if it seems tremendously stupid, but what happens here:

[41]> (defmacro foo (bar) (format t "~A" (type-of bar)))
FOO
[42]> (foo 'quux)
CONS
NIL

so that the symbol becomes a cons?

From: Joshua Taylor
Subject: Re: How does a quoted symbol become a CONS?
Date: 
Message-ID: <a9f26063-915e-46e1-9216-e1f2e6dfd7ff@e6g2000prf.googlegroups.com>
On Jan 15, 5:27 pm, "Leslie P. Polzer" <·············@gmx.net> wrote:
> Sorry if it seems tremendously stupid, but what happens here:
>
> [41]> (defmacro foo (bar) (format t "~A" (type-of bar)))
> FOO
> [42]> (foo 'quux)
> CONS
> NIL
>
> so that the symbol becomes a cons?

foo is a macro, and so it doesn't evaluate its arguments.

(foo 'quux) is the same as (foo (quote quux))

and so foo's argument is the the list whose first element is the
symbol quote and whose second element is the symbol quux. A list is of
type cons. I haven't tried it, but (foo quux) should give you symbol.

//J
From: Sohail Somani
Subject: Re: How does a quoted symbol become a CONS?
Date: 
Message-ID: <byajj.4483$vp3.3048@edtnps90>
On Tue, 15 Jan 2008 14:27:16 -0800, Leslie P. Polzer wrote:

> Sorry if it seems tremendously stupid, but what happens here:
> 
> [41]> (defmacro foo (bar) (format t "~A" (type-of bar))) FOO
> [42]> (foo 'quux)
> CONS
> NIL
> 
> so that the symbol becomes a cons?

Did you mean to do:

(defmacro foo (bar) 
  `(format t ... (type-of ,bar))) ?

In your original code, bar is not evaluated. Atleast that is my 
uninformed understanding. Dunno where the cons comes from though.

-- 
Sohail Somani
http://uint32t.blogspot.com
From: Joost Diepenmaat
Subject: Re: How does a quoted symbol become a CONS?
Date: 
Message-ID: <87zlv6emk3.fsf@zeekat.nl>
"Leslie P. Polzer" <·············@gmx.net> writes:

> Sorry if it seems tremendously stupid, but what happens here:
>
> [41]> (defmacro foo (bar) (format t "~A" (type-of bar)))
> FOO
> [42]> (foo 'quux)
> CONS
> NIL
>
> so that the symbol becomes a cons?

Did you mean:

(defmacro foo (bar) 
 `(format t "~A" (type-of ,bar)))

Note the quoting and escaping. Your format routine is going to be called
before bar is evaluated.

My guess is that bar is (quote quux) at that point. Someone else will
probably be here to correct my in a minute.

Joost.
From: Rainer Joswig
Subject: Re: How does a quoted symbol become a CONS?
Date: 
Message-ID: <joswig-11E50C.01253016012008@news-europe.giganews.com>
In article 
<····································@j20g2000hsi.googlegroups.com>,
 "Leslie P. Polzer" <·············@gmx.net> wrote:

> Sorry if it seems tremendously stupid, but what happens here:
> 
> [41]> (defmacro foo (bar) (format t "~A" (type-of bar)))
> FOO
> [42]> (foo 'quux)
> CONS
> NIL
> 
> so that the symbol becomes a cons?

Do a MACROEXPAND on (foo 'quux).

bar is  (quote quux)

type-of bar is cons

FORMAT t  prints "CONS" and returns NIL

So the MACROEXPANSION of the above is just NIL.
From: Leslie P. Polzer
Subject: Re: How does a quoted symbol become a CONS?
Date: 
Message-ID: <5d123ed9-740c-48d3-9438-5ddf4b588677@k39g2000hsf.googlegroups.com>
On Jan 16, 1:25 am, Rainer Joswig <······@lisp.de> wrote:

> bar is  (quote quux)


Yeah, (QUOTE quux) is obviously a CONS. Now I see it, too :)
Thanks! And no, I didn't mean to quote the macro expansion here.
From: ···············@gmail.com
Subject: Re: How does a quoted symbol become a CONS?
Date: 
Message-ID: <98b9528b-cadb-4ef6-ae03-c4c24c0c2e0f@i3g2000hsf.googlegroups.com>
On Jan 15, 5:27 pm, "Leslie P. Polzer" <·············@gmx.net> wrote:
> Sorry if it seems tremendously stupid, but what happens here:
>
> [41]> (defmacro foo (bar) (format t "~A" (type-of bar)))
> FOO
> [42]> (foo 'quux)
> CONS
> NIL
>
> so that the symbol becomes a cons?

Others have answered the superficial question.

The real question is why you want this to be a macro? FORMAT and TYPE-
OF are both functions.