" x)...">

Clojure nested tagged letters

I am trying to parse the PriorityMaps nested structure:

(def reader-map { 'util/pm (fn [x] (println "reading > " x) (parse-map x)) }) (binding [*data-readers* reader-map] (clojure.core/read-string "#util/pm \"{:z 4 :y #util/pm \"{:y 3 :x 3}\" :x 9}\"")) 

... but I do not see the nested string passed to my handler, as I expected, only the line before the first nested tag:

  reading > {:z 4 :y #er.util.net/pm 

what are you doing wrong?

+6
source share
1 answer

You need more backslashes if you want nested quotes:

 (binding [*data-readers* reader-map] (clojure.core/read-string "#util/pm \"{:z 4 :y #util/pm \\\"{:y 3 :x 3}\\\" :x 9}\"")) 
+5
source

Source: https://habr.com/ru/post/927216/


All Articles