Hacker News new | ask | show | jobs
by hcarvalhoalves 1783 days ago

    {:pre [(de/entity? entity)]}
is "syntactic sugar" for

    (hash-map (keyword "pre") (vector (de/entity? entity)))
while

    (.getAttribute mount "data")
is calling the method `.getAttribute` on the `mount` object – since it's a Lisp, it's in prefix notation. It also highlights how methods are not special and just functions that receive the object as first argument.

Finally,

    @*post
is the same as

    (deref *post)
and the `*` means nothing to the language – any character is valid on symbol names, the author just chose an asterisk.

Most of what you believe to be syntax are convenience "reader macros" (https://clojure.org/reference/reader), and you can extend with your own. You can write the same code without any of it, but then you'll have more "redundant" parenthesis.

1 comments

> Most of what you believe to be syntax are convenience "reader macros"

And yet, you need to know what all those ASCII symbols mean, where they are used, and they are indistinguishable from syntax.

Moreover, even Clojure documentation calls them syntax. A sibling comment provided a wonderful link: https://clojure.org/guides/weird_characters