I'm told that: `(,x)
is a shorthand for (cons x '())
.
I'm a bit confused because that's not documented anywhere.
Also if that is the case, what does `(((pea)) ,q)
evaluate to?
And why is pea
wrapped in two sets of parens?
I'm told that: `(,x)
is a shorthand for (cons x '())
.
I'm a bit confused because that's not documented anywhere.
Also if that is the case, what does `(((pea)) ,q)
evaluate to?
And why is pea
wrapped in two sets of parens?
is roughly equivalent to
When an expression inside backticks is preceded by a comma, that cancels out the backtick, so
is equivalent to
Since a list is a chain of pairs whose last cdr is the empty list, this is equivalent to
In your second example
is equivalent to
Basically, when you use backquote, you can treat it like an ordinary quoted expression, except that
,
"unquotes" the subexpression that follows it. So you convert it to calls tolist
andcons
with the non-comma expressions quoted, and the comma expressions not quoted.As for why it has two sets of parentheses, that depends on how this data is being used. They needed
pea
to be nested 2 levels deep for some reason.