2 ms·
Commonly used loop syntax is replete with syntax that breaks "op args ...": when <condition> do for <var> in <list> for <var0> = <init0> then <step0> and
by kazinator 8y ago
Commonly used loop syntax is replete with syntax that breaks "op args ...":
when <condition> do
for <var> in <list>
for <var0> = <init0> then <step0> and
for <var1> = <init1> then <step1>
collecting <expr> into <var>
The normal macros that don't have a flat argument structure, but shove everything into lists are keeping with the idea of leveraging the nesting so that the construct is "parsed on arrival" (POA?) into the macro. All that remains is to access its structure.
- kbp 8y agoSyntactically, those are things that could have been implemented as operators, but aren't, they're just LOOP keywords; lots of functions take keyword arguments (edit: even if LOOP's are a little different from &key parameters). LOOP avoids using unquoted lists for things other than calling operators. edit: Oh, right, destructuring, too! I guess that also counts. Out of curiosity, how would you feel about a macro like this (ignoring that it doesn't enforce any keyword order)? (defmacro for (var &key = (then =) while do) `(do ((,var ,= ,then)) ((not ,while)) ,do))