|
|
|
|
|
by axle_512
2892 days ago
|
|
Note I said "or looks like one". If you squint a bit, macros and built-ins are similar in structure to functions (they're all s expressions). I agree with much of what you said, but I still maintain that lisp syntax is still relatively trivial compared to most languages. I also don't think exposing newcomers to macros on a language that is homoiconic is terribly useful until they're already comfortable with the basic s-expression syntax. |
|
Because they have a parenthesis in front and back and the operator as first element. Macros then implement complex code structures between those:
and then Now remove the parentheses. Looks like a program in a typical language.Macro forms have lots of internal structure. For an extreme example check the syntax definition of the LOOP macro. Two pages of EBNF syntax declaration. That there are an opening parentheses and a closing one does not suddenly remove the syntax:
or the Lisp version: Does it LOOK like it has less syntax? Not really.> lisp syntax is still relatively trivial compared to most languages
Not really. Check out the concept of a code walker in Lisp. That's a tool which understands Lisp syntax and can walk over Lisp code and do transformations.
Here is one:
https://gitlab.common-lisp.net/cl-walker/cl-walker/tree/mast...
Mildly complex... complexity comes in, because Lisp has built-in syntax transformations via macros.