IN: delimited-continuations USING: kernel continuations namespaces sequences 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 ; : set-top ( quot -- obj ) '[ hole-push @ ] callcc1 ; inline : reset ( quot -- obj ) '[ @ abort-top ] set-top ; inline : shift ( quot -- obj ) '[ @ abort-top ] callcc1 ; inline : jump ( x k -- obj ) '[ _ _ continue-with ] set-top ; inline ! ( scratchpad ) [ [| k | 1 k jump k jump ] shift [| k | 2 k jump ] shift + ] reset 3 * . ! 15