Questions tagged [backquote]
33 questions
436
votes
11 answers
Usage of the backtick character (`) in JavaScript
In JavaScript, a backtick† seems to work the same as a single quote. For instance, I can use a backtick to define a string like this:
var s = `abc`;
Is there a way in which the behavior of the backtick actually differs from that of a single…

vancewang
- 5,120
- 3
- 15
- 14
43
votes
3 answers
Back-tick vs single quote in js
Working on node.js (server side), I wonder if I should use all back-ticks (`) instead of the regular quotes (" or ') all the time since it will make the code consistent. Is there any specific reason for keeping different type of quotes for different…

Ulysses
- 5,616
- 7
- 48
- 84
9
votes
3 answers
Macros That Write Macros - Compile Error
When I compile the following code, SBCL complains that g!-unit-value and g!-unit are undefined. I'm not sure how to debug this. As far as I can tell, flatten is failing.
When flatten reaches the unquoted part of defunits, it seems like the entire…

SpyroSoft
- 233
- 1
- 10
4
votes
2 answers
CHLS "innermost backquoted form should be expanded first" meaning
CLHS on backquotes states "If the backquote syntax is nested, the innermost backquoted form should be expanded first. This means that if several commas occur in a row, the leftmost one belongs to the innermost backquote."
But when I evaluate the…

Jisang Yoo
- 3,670
- 20
- 31
3
votes
2 answers
', (quote-comma) in common lisp
What is the effect and use of ', in backquoted expressions in lisp? Does it have a name and is it documented somewhere? And how common and useful is it?
For example:
(defmacro test-exp (exp)
`(format t "~&~S => ~S~%" ',exp ,exp))
My guess is that…

Michele Piccolini
- 2,634
- 16
- 29
3
votes
3 answers
backquote, unquote and unquote-splicing in normal functions
I am still in the process of understanding macros and though I think I understand the basics of "backquote" "unquote" and "unquote splicing", I had thought they were only used/useful in macros.
however I came across this Common Lisp code from…

Kyuvi
- 360
- 3
- 13
2
votes
1 answer
Why this Common Lisp macro does not work? Is the answer sheet from the book wrong?
I am trying to learn Common Lisp with the book Common Lisp: A gentle introduction to Symbolic Computation. In addition, I am using SBCL, Emacs, and Slime.
In chapter 14, the last one, the author covers macros. The following problem is…

Pedro Delfino
- 2,421
- 1
- 15
- 30
2
votes
1 answer
'Symbol's value as variable is void:' when using parameter on defun inside lambda
I would like to make this function to set keybind more shorter.
(defun defkey-arg2 ()
(exwm-input-set-key (kbd "s-g")
(lambda ()
(interactive)
(start-process-shell-command…

moanrisy
- 109
- 1
- 12
2
votes
2 answers
Quoting in macro-defining macro
I'm trying to write a macro that defines some helpers for struct-of-arrays data structure (based on this snippet). Inside that macro I define another macro that helps with traversing all of the slot values in struct. The thing is I can't make double…

Andrew Kravchuk
- 356
- 1
- 5
- 17
1
vote
2 answers
format of lambda in emacs lisp
I'm tring to apply closure in emacs lisp.And I find a post here:
How do I do closures in Emacs Lisp?
with some code like:
(defun foo (x) `(lambda () ,x)) (message (string (funcall (foo
66))))
But following the emacs documentation lambda should…

NStal
- 959
- 1
- 8
- 19
1
vote
1 answer
Association list - how set value to the result of a function execution
On high level: I'm trying to create an association list in which value is a result of function execution. What I get instead is an expression which represents that function, and which needs to be wrapped into "eval" to get it to work. I'm trying to…

ansa
- 71
- 5
1
vote
0 answers
reading file's content and printing it to stdout in assembly x64
I wrote a very simple assembly program (x64, linux) which reads the contents from /etc/passwd (doesn't really matter from where) and writes it to stdout. I compile it with nasm (nasm -f elf64 foo.asm -o bar). I receive the following error: ./bar:…

Inter Sys
- 129
- 7
1
vote
4 answers
How to escape nested single quotes inside back tick or back quote
Let's say we have the following template literal in ES6.
`'{"0": "It's Friday today"}'`
How do we escape the single quote in the word It's
Also, let's say we have the following template literal:
`'{"0": "Thursday\nFriday"}'`
How do we escape the…

Saurabh Bhatia
- 1,875
- 1
- 20
- 29
1
vote
1 answer
Ruby: How to insert three backslashes into a string?
I want to use backticks in ruby for a programm call.
The parameter is a String variable containing one or more backticks, i.e.
"&E?@@A`?". The following command yields a new label as its return value:
echo "&E?@@A\`?" | nauty-labelg…

ewi
- 175
- 1
- 9
1
vote
3 answers
When to use backquote in scheme?
For scheme implementation supporting R5RS, defining a macro can be done by pattern matching in syntax-rule, in this case why we need backquote?
I learn some very basic lisp through emacs lisp , in elisp we have to use lots of backquote to write a…

BooAA
- 173
- 3
- 11