Skip to content

Latest commit

 

History

History
199 lines (173 loc) · 4.73 KB

EXAMPLES.org

File metadata and controls

199 lines (173 loc) · 4.73 KB

Example Usage

parse-str/1

(lfedn:parse-str "{}")
#(ok #(map ()))
(lfedn:parse-str "1")
#(ok 1)
(lfedn:parse-str "true")
#(ok true)
(lfedn:parse-str "nil")
#(ok nil)
(lfedn:parse-str "[1 true nil]")
#(ok #(vector (1 true nil)))
(lfedn:parse-str "(1 true nil :foo)")
#(ok (1 true nil foo))
(lfedn:parse-str "(1 true nil :foo ns/foo)")
#(ok (1 true nil foo #(symbol ns/foo)))
(lfedn:parse-str "#{1 true nil :foo ns/foo}")
#(ok #(set (1 true nil foo #(symbol ns/foo))))
(lfedn:parse-str "#myapp/Person {:first \"Fred\" :last \"Mertz\"}")
#(ok #(tag myapp/Person #(map (#(first #"Fred") #(last #"Mertz")))))
(lfedn:parse-str "#{1 true #_ nil :foo ns/foo}")
#(ok #(set (1 true #(ignore nil) foo #(symbol ns/foo))))
(lfedn:parse-str "#{1 true #_ 42 :foo ns/foo}")
#(ok #(set (1 true #(ignore 42) foo #(symbol ns/foo))))

to-string/1

(set `#(ok ,result) (lfedn:parse-str "{:a 42}"))
#(ok #(map (#(a 42))))
(lfe_io:format "~s~n" `(,(lfedn:to-string result)))
{:a 42}
ok

to-lfe/1

(lfedn:to-lfe (element 2 (lfedn:parse-str "[1  nil  :nil  \"asd\"]")))
(1 nil nil #"asd")