This is a read-only archive of lispforum.com. The forum was locked to new users and posts and is preserved here as static HTML from a database snapshot taken on 2019-09-07.

macro / backquote notation

5 posts · 4356 views

Hi,

I've found an expression like this
`(and ,.(first (nreverse ris)))
that is seems, evaluating, the same of
`(and ,@(first (nreverse ris)))
I've never seen or read about [,.]: is that anything different with [,@]?

Thanks

filfil

Re: macro / backquote notation

Yes, comma-dot operates destructively with the form which is unquoted by that. Look at this SBCL session:
* (defvar *a* (list 'a 'b 'c))

*A*
* `(1 2 3 ,@*a* 4 5 6)

(1 2 3 A B C 4 5 6)
* *a*

(A B C)
* `(1 2 3 ,.*a* 4 5 6)

(1 2 3 A B C 4 5 6)
* *a*

(A B C 4 5 6)
*
cl-2dsyntax is my attempt to create a Python-like reader. My mirror of CLHS (and the dark themed version). Temporary mirrors of aferomentioned: CLHS and a dark version.

Re: macro / backquote notation

Thank you very much!

Re: macro / backquote notation

filfil, was the usage you found in performance critical code, or just a macro expander? If the latter, it seems like a false economy. Better to use ,@ and avoid the possibility of bugs caused by destructively modifying the following form, IMO. Generally, if your macro expander runs incrementally slower, you simply won't notice or care.
Cheers, Dave
Slowly but surely the world is finding Lisp. http://www.findinglisp.com/blog/

Re: macro / backquote notation

It's a macroexpander.Thank you for the warning!