On Sat, May 04, 2019 at 11:27:28PM -0700, C K Kashyap wrote:
> Thank you so much Alex ... What would it take to transform this code to
> handle string as input instead of file stream?
There are two ways:
1. To parse strings directly, then a different code is needed. As an example,
see 'parseJson' (strings) versus 'readJson' (input stream) in "@lib/json.l".
2. Simpler is to use a pipe, printing strings to one end and reading from the
other:
: (parseJson "{a: 7, s: \"abc\"}")
-> ((a . 7) (s . "abc"))
: (pipe (prinl "{a: 7, s: \"abc\"}")
(readJson) )
-> ((a . 7) (s . "abc"))
☺/ A!ex
--
UNSUBSCRIBE: mailto:[email protected]?subject=Unsubscribe