make json-stream-read a fold-like operation? Duy Nguyen (20 Jan 2020 09:47 UTC)
Re: make json-stream-read a fold-like operation? John Cowan (20 Jan 2020 14:18 UTC)
Re: make json-stream-read a fold-like operation? Amirouche Boubekki (21 Jan 2020 10:41 UTC)
Re: make json-stream-read a fold-like operation? Duy Nguyen (21 Jan 2020 12:52 UTC)
Re: make json-stream-read a fold-like operation? Amirouche Boubekki (21 Jan 2020 15:39 UTC)
Re: make json-stream-read a fold-like operation? Duy Nguyen (23 Jan 2020 09:08 UTC)

Re: make json-stream-read a fold-like operation? Duy Nguyen 21 Jan 2020 12:51 UTC

On Tue, Jan 21, 2020 at 5:40 PM Amirouche Boubekki
<xxxxxx@gmail.com> wrote:
>
> Le lun. 20 janv. 2020 à 15:18, John Cowan <xxxxxx@ccil.org> a écrit :
> >
> > LGTM
> >
> > On Mon, Jan 20, 2020 at 4:48 AM Duy Nguyen <xxxxxx@gmail.com> wrote:
> >>
> >> Is it possible to make 'proc' in json-stream-read take a third, opaque
> >> object, and pass proc's result to the next 'proc' call?
> >> json-stream-read returns the result of the last 'proc' call.
> >>
> >> I think by chaining these proc calls together, json-stream-read user
> >> can pass parsing state along and can even avoid mutable states if they
> >> want to. I haven't looked at the implementation though so I don't know
> >> how hard to do it.
>
> That occured to me but I am wondering whether it would not be better
> to make json-stream-read (possibly with a new name) return a
> generator.

I haven't used generators a lot (at least not in Scheme) so I can't
really contribute anything here. With John's suggesting to go with
generators in other parts of the srfi, I guess we might as well do
generators here :)
--
Duy