4 ms·
Isn't LISP a language that prides itself in having no special forms? A macro is a macro is a macro. (macroname first-param third-param
by dmitriid 8y ago
Isn't LISP a language that prides itself in having no special forms? A macro is a macro is a macro.
(macroname
first-param
third-param
fourth-param
ad-infinitum)
This is the only case (there are no special, or complex, or any other cases).
Besides, if you took your time and actually read the article, you'd see `defn` in the examples.
- lispm 8y ago> Isn't LISP a language that prides itself in having no special forms No, that's a misconception. Lisp has special forms from day one (1960). On day two (1962), macros were added -> they implement even more syntax.
- TeMPOraL 8y ago> A macro is a macro is a macro. At the syntax level, yes. But indentation is not a syntax-level concern, but a semantic one. Speaking Clojure, (defn function [arg] {:some-op arg}) has the exact same syntactic structure to (assoc-in some-map [path] {:some-key path}) but it's expected to be indented differently because of the difference in meaning between defn and assoc-in. Lisp allows you to use macros to provide new symbols that, put first in a list, imply something else than function call. So user-defined forms are put on equal footing with things like if or defn. And user-defined things can generate more user-defined things that are meant to be indented like defn. Hence the need for loading the code for correct indentation.
- dmitriid 8y agoNah. I still don't see the difference :) To me all of these are some macros/functions that expect certain parameters. Makes it much easier to reason about code IMO (especially if they are indented similarly).
- kazinator 8y agoEven the basic lisp mode in Vim recognizes the difference. There is a :set lispwords=... list of symbols that are operators. They get indented like this: (lispword a b c d e f g h) whereas symbols not in the set like this: (not-lispword a b c d e f) This is important so we don't end up with this: (let ((x y)) form form) or, vice versa, this: (list (item 1) (item 2) (item 3) (item 4))