Re:Ziglings: Learn the Zig programming language by fixing ti...
by fpoling on Saturday February 13, 2021 @05:19PM
(#26127521)
I was not aware that unquoting in Common Lisp can be applied to data. So it is not a specialized sub language just for macros, but a general purpose template system that could also generate code.
[ Parent
| on HN ]
Re:Ziglings: Learn the Zig programming language by fixing ti...
by ywei3410 on Saturday February 13, 2021 @10:47PM
(#26129494)
It's really a shorthand for writing lists - sexp's are lists, so can use the same syntax.
Macro's in Lisp are essentially "just" functions where the arguments are un-evaluated - you can use all the same functions etc...
Writing a simple Lisp interpreter is really quite educational - when you add macros and quoting into the language, you suddenly have a realisation at how simple it is.
Re:Ziglings: Learn the Zig programming language by fixing ti...
by kazinator on Saturday February 13, 2021 @08:15PM
(#26128748)
That's right. There is no difference between:
(defmacro my-quote (x)
`(quote ,x))
and (defmacro my-quote (x)
(list 'quote x))
That `(quote ,x) is just way of writing (list 'quote x), not a notation for writing macros.That's it.