Hi Geri,

> Good thing you're having fun writing useful projects!
>

I am indeed. Especially now, I am getting past more academic exercises and
appreciating how easy it is to wire things together with picolisp.
https://en.wikipedia.org/wiki/Unix_philosophy
I do want to get a better handle on native interfacing and the db
mechanism.

- Data on json.org is not a full spec, I recommend using ECMA404 or
> RFC8259, as they specify behaviours way more accurately. For example, I'm
> not sure if i saw if it can parse UTF-16 surrogate pairs (this lets you
> parse encoded emojis), which is specified in the RFC.
>
- Look into `loop`, it can make your code quite a bit neater. For example
> most of the NotDone flags could be removed by using loop conditionals.
>
 👍

- You can probably use make and link in more cases, but I'm not sure if
> it's better than current approach, @abu probably knows.
>
I will try this. If it is possible to nest make environments recursing into
nested structures it would neaten things up quite a bit.


> - Check out https://picolisp.com/wiki/?simplerfc8259json if you want some
> inspiration (maybe into direction of "oh god this is horrible", I don't
> mind :D)
>
Nice example! and very neat code I am aspiring to. Is this page linked from
one of the main pages?
I missed it earlier when I was looking for examples to start from.

I went with a very consistent data structure where the parser represents
all values as strings and makes an effort to infer the json type and
include it in the output.
It doesn't try to map to a picolisp type and leaves the interpretation
context to whatever is consuming the output.

I used nested (assoc) lists and am adding a function, something like 'nth',
to easily extract elements from the structure. For very large datasets that
need random access it is straightforward to convert the 'assoc' lists to
'idx' or 'enum'. So far, the assoc lookup is more than performant enough
for my purpose.

Sets:
((NIL . "object") ... ) ((NIL . "array") ...)
Values:
("true" . "bool") ("false" . "bool") ("null" . "null") ("abcd" . "string")
("1234" . "number") ( NIL . "undefined").... etc


> Have fun!
>
Ditto!

/Lindsay

Reply via email to