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
@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
@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
text/gemini
This content has been proxied by September (3851b).