Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Lisp Question

Name: Anonymous 2016-09-07 18:50

What would be the result of
(consp (car (cadr '`(,@(list "abc")))))
???

Is it guaranteed to be that? Explain your answer.

Name: Anonymous 2016-09-09 5:53

'`(,@(list "abc"))
You're quoting a backquoted expression, and there are some implementation differences in how backquote is implemented, and how it's printed. Some parts will stay the same as much as its guaranteed by the ANSI CL standard and some will change. Here's an example of a part that won't be portable:
* (first '`(abc))
QUOTE
* (first '`(abc ,(list)))
SB-IMPL::BACKQ-LIST

* '`(abc ,(list))
`(ABC NIL)
* '`(abc nil)
'(ABC NIL)

The printer will turn that SB-IMPL::BACKQ-LIST into `, but you can always examine the list yourself. It will be different for a different implementation. This doesn't prevent you from writing macros that write macros because once it's all expanded, it will all work the same, but if you're trying to dissect the generated code programmatically you will encounter surprises like this one.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List