This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-01-06
Channels
- # architecture (8)
- # aws (2)
- # beginners (156)
- # boot (163)
- # cider (22)
- # cljs-dev (2)
- # cljsrn (11)
- # clojars (6)
- # clojure (328)
- # clojure-austin (7)
- # clojure-dusseldorf (10)
- # clojure-italy (2)
- # clojure-russia (19)
- # clojure-spec (178)
- # clojure-uk (86)
- # clojurescript (81)
- # cursive (17)
- # datomic (33)
- # funcool (40)
- # hoplon (8)
- # jobs (5)
- # klipse (13)
- # leiningen (1)
- # luminus (21)
- # off-topic (140)
- # om (49)
- # om-next (4)
- # onyx (29)
- # planck (5)
- # protorepl (2)
- # re-frame (58)
- # reagent (2)
- # remote-jobs (4)
- # ring-swagger (16)
- # testing (1)
- # untangled (26)
- # yada (27)
@ambrosebs Remove the quote. (identity ^:foo a)
e.g.
(let [a 1]
(meta (identity ^:foo 'a)))
=> nil
(let [a 1]
(meta (identity '^:foo a)))
=> {:foo true}
Yeah it happens for me too @ambrosebs. Pretty sure its a bug?
Yeah I have no idea if it's a feature or a happy accident. My thought was the same as yours at first kenny, but I figured ambrosebs knows the clojure pretty gud, so I checked 🙂
Yeah, I haven't seen that before. I'm curious if it is officially supported or if the behavior will be removed in a future version of Clojure.
I think that all flows from the reader rules, even though it’s not obvious
^:foo
is applied to the next thing read
’x
is expanded to (quote x)
so (identity ^:foo ‘a)
expands to (identity ^:foo (quote a))
- note that the meta is applied to the list, so after evaluation you’re left with just the symbol a with no meta
and (identity '^:foo a)
expands to (identity (quote ^:foo a))
which returns a symbol with meta for the same reasons