Re: Alternative topological sorting implementation
Maxime Devos 13 Apr 2023 16:00 UTC
Op 13-04-2023 om 17:29 schreef Marc Nieper-Wißkirchen:
> Hi Maxime,
>
> Thanks for sharing your code!
>
> I don't see many delimited continuations at work, though. The
> continuation-related primitive in your code is basically
> abort-to-prompt, which is here of equal power as C's longjmp or other
> languages throw/catch (and reflects the most typical use of Scheme's
> classical call/cc). But maybe I miss something in your code.
I won't comment on longjmp because that's too long ago for me.
Maybe it is just throw/catch in disguise, but I don't see it -- on line
57 + 66/70, the continuation is reinstated, which isn't something you
can do with throw/catch; you need raise-continuable/guard for that.
I'm not sure if raise-continuable/guard is sufficient because there is
also a little state ('visiting' and 'visited') and I wanted to avoid
'set!', but perhaps I'm just implementing 'set!' in terms of delimited
continuations here.
> [...]
Greetings,
Maxime.