Hi Joe,

> Are there any tips on how to port the json example to ersatz since it
> does not support pipe? I experimented with parsing out the string into
> a new string and calling str on it but didn't get very far yet. I'd
> like something that can parse a string.

The function 'str' is the brother of 'read' in this context. It accepts
an analog argument syntax:

   : (str "{ \"foo\": 1, \"bar\": [10, \"apples\"] }" "_")
   -> ("{" "foo" ":" 1 "," "bar" ":" "[" 10 "," "apples" "]" "}")

You could modify 'readJson' so that it operates on the resulting list
instead of the current input channel.


On the other hand, is this really necessary? I see JSON primarily as an
I/O format. The string argument was just a requirement of the
RosettaCode task. I would expect that typical application would rather
call (readJson) in an 'in' body (reading from a file or socket). Reading
a string first, and converting it immediately, is just overhead.

Cheers,
- Alex
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to