@@ -19,7 +19,7 @@ __This project is in flux. Anything may change at any time.__
1919__ Leiningen ([ via Clojars] ( http://clojars.org/rewrite-clj ) )__
2020
2121``` clojure
22- [rewrite-clj " 0.1 .0" ]
22+ [rewrite-clj " 0.2 .0" ]
2323```
2424
2525__ Parsing Data__
@@ -62,7 +62,7 @@ operations, based on [fast-zip](https://github.com/akhudek/fast-zip).
6262" (defn my-function [a]
6363 ;; a comment
6464 (* a 3))" )
65- (def data (z/edn ( p/parse -string data-string) ))
65+ (def data (z/of -string data-string))
6666
6767(z/sexpr data) ; ; => (defn my-function [a] (* a 3))
6868(-> data z/down z/right z/node) ; ; => [:token my-function]
@@ -71,7 +71,7 @@ operations, based on [fast-zip](https://github.com/akhudek/fast-zip).
7171(-> data z/down z/right (z/edit (comp symbol str) " 2" ) z/up z/sexpr)
7272; ; => (defn my-function2 [a] (* a 3))
7373
74- (-> data z/down z/right (z/edit (comp symbol str) " 2" ) z/root prn/ print-edn )
74+ (-> data z/down z/right (z/edit (comp symbol str) " 2" ) z/print-root )
7575; ; (defn my-function2 [a]
7676; ; ;; a comment
7777; ; (* a 3))
@@ -102,7 +102,7 @@ use `rewrite-clj.zip/next`, if you wanted to look for something on the same leve
102102Now, to enter the project map, you'd look for the symbol ` defproject ` in a depth-first way:
103103
104104``` clojure
105- (def data (z/edn ( p/parse -file " project.clj" ) ))
105+ (def data (z/of -file " project.clj" ))
106106(def prj-map (z/find-value data z/next 'defproject))
107107```
108108
@@ -116,7 +116,7 @@ The `:description` keyword should be on the same layer, the corresponding string
116116Replace it, zip up and print the result:
117117
118118``` clojure
119- (-> descr (z/replace " My first Project." ) z/root prn/ print-edn )
119+ (-> descr (z/replace " My first Project." ) z/print-root )
120120; ; (defproject my-project "0.1.0-SNAPSHOT"
121121; ; :description "My first Project."
122122; ; ...)
@@ -144,14 +144,14 @@ rewrite-clj aims at providing easy ways to work with Clojure data structures. It
144144to the standard seq functions designed to work with zipper nodes containing said structures, e.g.:
145145
146146``` clojure
147- (def data (z/edn ( p/parse -string " [1\n 2\n 3]" ) ))
147+ (def data (z/of -string " [1\n 2\n 3]" ))
148148
149149(z/vector? data) ; ; => true
150150(z/sexpr data) ; ; => [1 2 3]
151151(-> data (z/get 1 ) z/node) ; ; => [:token 2]
152152(-> data (z/assoc 1 5 ) z/sexpr) ; ; => [1 5 3]
153153
154- (with-out-str ( - >> data (z/map #(z/edit % + 4 )) z/node prn/print-edn) )
154+ (- >> data (z/map #(z/edit % + 4 )) z/->root-string )
155155; ; => "[5\n6\n7]"
156156```
157157
0 commit comments