syntax - Clojure — Meaning of pound symbol?` -


in om next quick start, use #js , #uuid. pound symbol here mean?

link: https://github.com/omcljs/om/wiki/quick-start-(om.next)#components-with-queries--mutations

snippets:

#js:

(defui counter   static om/iquery   (query [this]     [:count])   object   (render [this]     (let [{:keys [count]} (om/props this)]       (dom/div nil         (dom/span nil (str "count: " count))         (dom/button           #js {:onclick                (fn [e] (om/transact! '[(increment)]))}           "click me!"))))) 

#uuid:

(om/from-history reconciler   #uuid "9e7160a0-89cc-4482-aba1-7b894a1c54b4") 

commonly found in edn , clojurescript use of # called tagged literal. @ example,

user=> (java.util.date.) #inst "2014-05-19t19:12:37.925-00:00" 

when create new date represented tagged literal, or in case tagged string. can use clojures read-string read (or use directly)

user=> (type #inst "2014-05-19t19:12:37.925-00:00") java.util.date (read-string "#inst \"2014-05-19t19:12:37.925-00:00\"") #inst "2014-05-19t19:12:37.925-00:00" user=> (type (read-string "#inst \"2014-05-19t19:12:37.925-00:00\"")) java.util.date 

a tagged literal tells reader how parse literal value. other common uses include #uuid generating uuids , in clojurescript world extremely common use of tagged literals #js can used convert clojurescript data structures javascript structures directly.

courtesy: the weird , wonderful characters of clojure


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -