Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Does the author mean "character" in a literary sense? Because many of these things have better names, and in fact "character" is wholly incorrect for anything like "#_" or "#'" which consist of multiple characters.

Also, functions are not methods, and the terms are not interchangeable.

All of this is summarized in a much more succinct and correct fashion here: http://clojure.org/reader



> and in fact "character" is wholly incorrect for anything like "#_" or "#'" which consist of multiple characters.

#_ is a character for the dispatch invocation, and a dispatch character. The way it's used in TFA is perfectly understandable.

> All of this is summarized in a much more succinct and correct fashion here: http://clojure.org/reader

Which uses the word "character" to describe them. And gives no examples, so it may be more succinct but is also of very limited use to people who have no idea what this is about. Those who know what it's about are not going to google for macro characters.


The word "character" is used to describe them because they are certainly made of characters. The most generic term for everything but the macro characters themselves is "form". The dispatch macro is a special case that is not a form, but represents reader macros that are applied to forms as they are read. Same goes for quoting. But all of the specific cases of #_ or #{ or #" etc. are more than just characters.

And the docs do in fact give plenty of examples. I'm not sure how you can say "no examples" when there are examples for most of the things described on the page.

It may be dense, but the writing is clear and you can just read it start to finish.

EDIT: I see what you mean about "macro characters".

Just to be as clear as possible:

# - a macro character which dispatches on the next character

#{:foo :bar} - a hash-set literal form

#(...) - an anonymous function literal form

' - the quote character

'foo - a quoted symbol form

-> - the threading macro (just a normal symbol)

(-> x inc str) - a form using the threading macro


> The word "character" is used to describe them because they are certainly made of characters.

In OP, the word "character" is used because they're characters and they're hard to search for when you don't know clojure and you're trying to understand what the hell this crazy crap is. So the goal is to match "clojure $something character", something along those lines.

> The dispatch macro is a special case that is not a form, but represents reader macros that are applied to forms as they are read.

Yes, but that's missing the purpose of OP. If you don't know that ' is `quote`, what do you do?

> And the docs do in fact give plenty of examples. I'm not sure how you can say "no examples" when there are examples for most of the things described on the page.

No, the docs give no example aside from metadata (and even then it's not great) and syntax-quote. For other macro characters it gives the expansion, no example and little to nothing in the way of explanation.

> Just to be as clear as possible:

Yes, the point being that those things are hard to search for

> #(...) - an anonymous function literal form

That's not a function literal form, `fn` is the function form (and `fn` a layer over it which handles binding forms), `#()` is a reader macro over that*.


Maybe I'm spoiled because when I started out with Clojure I just went to clojure.org and read it.

The only things on the OP's page without an explicit example on clojure.org/reader are: "#_", "%" for args, ";" for comments, and "$" as part of a class name.


I think "token" would be more technically accurate.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: