function
boot.janet on line 2555, column 1
(parse str)
Parse a string and return the first value. For complex parsing,
such as for a repl with error handling, use the parser api.
# `parse` can decode arbitrary JDN (Janet Data Notation) encoded by `string/format`
(def encoded (string/format "%j" @{:a 123 :b "foo" :c @{1 [1.2 2.3 3.4]}}))
# => "@{:a 123 :b \"foo\" :c @{1 @[1.2 2.2999999999999998 3.3999999999999999]}}"
(parse encoded)
# => @{:a 123 :b "foo" :c @{1 @[1.2 2.3 3.4]}}
(parse "(+ 4 5)") # => (+ 4 5)
(type (parse "(+ 4 5)")) # => :tuple
(parse "[:a :b :c]") # => [:a :b :c]