Both symbols and keywords, when placed inside of an expression in the first position, e.g. (:my-keyword my-map), or ('some-symbol my-map), behave as functions that "look themselves up" in the map that is the first argument, and if that symbol or keyword is a key in that map, the associated value is returned from the expression. This is most often used for keywords, but it does also work for symbols, which is what is happening in your expression. The number `1` is not a map, and both this kind of lookup expression, as well as the function `get`, have always returned nil when the thing-to-be-looked-up-in is not a map or set (or anything else that implements the appropriate lookup interface methods being used in the Java implementation under the covers there).
Some other examples of similar behavior: $ clj Clojure 1.10.1 user=> ('f 1) nil user=> ('f 1 :not-found) :not-found user=> ('f {'f 17 :bar 8}) 17 user=> ('f {:bar 8} :not-found-value) :not-found-value user=> (get {'f 17 :bar 8} 'f) 17 user=> (get 1 'f) nil user=> (get 1 'f :not-found) :not-found Andy On Sat, Oct 26, 2019 at 10:05 AM Johannes <bra...@nordakademie.de> wrote: > ... instead of an exception? > > Can anyone explain it to me? > > Johannes > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with > your first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en > --- > You received this message because you are subscribed to the Google Groups > "Clojure" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to clojure+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/clojure/f2007954-107c-4918-bf0a-6bfd8040ba39%40googlegroups.com > <https://groups.google.com/d/msgid/clojure/f2007954-107c-4918-bf0a-6bfd8040ba39%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/clojure/CAKvLtDYiLJVXxCUTSsaHZXOTAzk4pYGk2%3DJ09Ac2MkYS8aXO5A%40mail.gmail.com.