开发者

What are the usages for ^ and how can I get more information on it?

开发者 https://www.devze.com 2023-01-19 10:44 出处:网络
found this on a blog : (def x ^{:type ::my-class} {}) apparently it adds meta data to a map user=> (meta x)

found this on a blog : (def x ^{:type ::my-class} {})

apparently it adds meta data to a map

user=> (meta x)
{:type :user/my-class}
  1. what else does ^ do ? does it have any other uses ? can it be used as a getter for meta data (not just to set meta data) ?

  2. how can i开发者_Python百科 find out information about some shortcuts in clojure ? like ^, ', `, ~. is it possible to get that from the repl ?


Look at the documentation for the Clojure reader, specifically the section on macro characters:

The Reader

Edit: Metadata has documentation too :-)

0

精彩评论

暂无评论...
验证码 换一张
取 消