News for hackers. Stuff that matters.
Re:Better Clojure formatting by dmitriid on Friday December 07, 2018 @06:36AM (#18626820)
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.

Re:Better Clojure formatting by TeMPOraL on Friday December 07, 2018 @06:45AM (#18626869)
> 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.

Re:Better Clojure formatting by dmitriid on Friday December 07, 2018 @08:51AM (#18627590)
Nah. 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).
Re:Better Clojure formatting by kazinator on Saturday December 08, 2018 @12:44AM (#18634100)
Even 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))
Re:Better Clojure formatting by lispm on Friday December 07, 2018 @06:37AM (#18626829)
> 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.