IN: delimited-continuations USING: kernel continuations namespaces locals sequences accessors fry ; SYMBOL: Holes : hole-init ( -- ) V{ } clone Holes set ; : hole-push ( hole -- ) Holes get push ; : hole-pop ( -- hole ) Holes get pop ; : abort-top ( v -- * ) hole-pop continue-with ; : reset ( quot -- obj ) '[ hole-push @ abort-top ] callcc1 ; inline :: shift ( quot -- obj ) [| return-shift | [| x | [ hole-push x return-shift continue-with ] callcc1 ] quot call abort-top ] callcc1 ; inline