Ancestors

Written by Csepp 🌢 on 2025-01-05 at 03:45

Can you express streams / lazily evaluated lists with an eagerly evaluated fold combined with a continuation in #Scheme / #OCaml / other languages with some form of continuations? :flan_think:

And if so, are there existing libraries that build on this?

I'm pretty sure it's possible, at least with unconstrained call/cc, not quite sure about more restricted variations, or how it would work with typing.

I'd try to prototype it myself but I have my final exam coming up, so I hope tooting about it is enough to get it out of my system. :neofox_laugh_sweat:

cc: #compsci

=> More informations about this toot | More toots from csepp@merveilles.town

Written by Bad Diode on 2025-01-05 at 08:34

@csepp hmm not sure, if the fold is eager how could it reduce a lazy list? The cc could probably be used to implement a lazy fold but not quite sure they can be combined like that unless the fold blocks as well while waiting. Not a big cc user or anything and also maybe I misinterpreted your Q, but curious about other answers

=> More informations about this toot | More toots from bd@merveilles.town

Toot

Written by Csepp 🌢 on 2025-01-05 at 13:37

@bd Well, you can implement return in terms of call/cc (it's one of the canonical examples), so all you would need (in theory, I haven't tested this) is to know when to return from the fold.

=> More informations about this toot | More toots from csepp@merveilles.town

Descendants

Proxy Information
Original URL
gemini://mastogem.picasoft.net/thread/113776017791418754
Status Code
Success (20)
Meta
text/gemini
Capsule Response Time
260.244161 milliseconds
Gemini-to-HTML Time
1.229763 milliseconds

This content has been proxied by September (3851b).