Length again and definition of macro

"feilong" <[email protected]>
Newsgroups gmane.lisp.allegro
Message-ID <003401c2bc88$9b65a820$94316086@dfkimnqs21x0xb>
Hello,freinds:
Just now i have tried to get the length of (length (quote quote)),but i get the error message. 

CG-USER(8): (length (quote quote))
Error: attempt to take the length of a non-sequence: QUOTE
[condition type: SIMPLE-ERROR]
 
I have not very understood, (length (quote '(1 2 3))) is 2, (length (quote quote)) should be also 2, while this list consist 2 parts(quote + quote), and quote is macro, semantic is also correct. And if (length (quote '(1 2 3))) is 2, then (length (list '(1 2 3))) should be also 2, while this list has 2 parts: symbol list and list (1 2 3). But the result is 3. Why? Whether quote operator does not evaluats the expression, aber list operator must evaluate the expression.

CG-USER(2): (length (list 1 2 3))
3

Why is the begin of definition of makro almost list operator. For example own definition my-if
(defmacro my-if (test then else)
          (list '(cond (list test then) (list 't else))) ;;part1

Can I so define the body of macro: (cond (test then) (t else));;part2 
while i thinkd part1 is equivalent to part2, can man replace part1 with part2? What is the difference?

Another example: own nil macro
(defmacro nil! (x)
          (list 'setf x nil));;part1 is equal to setf x nil
Can man replace part1 with (setf x nil)?

Best Greetings  
Xu
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.