2 ms·
The point is to make accessing a data structure somewhat "generic". I only have to change the "(car a)" to "(superdupercar a)" and the "setf" propagates the ch
by bsder 2y ago
The point is to make accessing a data structure somewhat "generic". I only have to change the "(car a)" to "(superdupercar a)" and the "setf" propagates the changes along. This is especially important inside macros.
It is also the reason why Lisps can feel so icky. This is a huge hunk of "macro magic" that can be damn near impenetrable when something goes wrong.
The longer I'm at this the more I'm convinced that macros are the reason why Lisp lost. Even if I concede that macros are hugely powerful, every language that leans into something equivalent to macros winds up with inscrutable errors, debugging issues and/or excessive compile times.
- kazinator 2y agoIf you change (car a) to (superdupercar a), then (setf (superdupercar a) x) no longer works. You have to program the generalized place system of Common Lisp to recognize (superduper ...) as a place, and define what that means; then all is well. It could be as simple as (defsetf superdupercar superduperrplaca) If you have a function (superduperrplaca a x).
- deleted 2y ago[deleted]