Re: json-read vs json-fold
Amirouche Boubekki 07 Feb 2020 17:27 UTC
Hello Lassi,
Le ven. 7 févr. 2020 à 16:52, Lassi Kortela <xxxxxx@lassi.io> a écrit :
>
> > What do you think about making the tokenizer, that is now called
> > json-tokens, an optional argument of json-fold? Since it is easy to
> > implement json-read with json-fold, I would not propagate the optional
> > argument to json-read to keep the signature simpler. Eventually, it
> > would be easier to somehow handle unpaired surrogates.
>
> A JSON fold makes sense. But if `json-tokens` is a generator, the
> generic `generator-fold` from SRFI 158 should be usable on it;
Yes
> do we need a custom fold just for JSON?
json-fold signature is different from generator-fold:
(json-fold proc object-start object-end array-start array-end seed events)
where EVENTS is a generator.
--
Amirouche ~ https://hyper.dev