Paste: delimited continuations
Author: | glguy |
Mode: | factor |
Date: | Mon, 6 Apr 2009 22:52:06 |
Plain Text |
IN: delimited-continuations
USING: kernel continuations namespaces locals sequences accessors fry ;
SYMBOL: Holes
: hole-init
V{ } clone Holes set ;
: hole-push
Holes get push ;
: hole-pop
Holes get pop ;
: abort-top
hole-pop continue-with ;
: reset
'[ hole-push @ abort-top ] callcc1 ; inline
:: shift
[| return-shift |
[| x |
[ hole-push x return-shift continue-with ] callcc1
] quot call abort-top
] callcc1
; inline
Author: | glguy |
Mode: | factor |
Date: | Tue, 7 Apr 2009 18:01:13 |
Plain Text |
IN: delimited-continuations
USING: kernel continuations namespaces locals sequences accessors fry math ;
SYMBOL: Holes
: hole-init
V{ } clone Holes set ;
: hole-push
Holes get push ;
: hole-pop
Holes get pop ;
: abort-top
hole-pop continue-with ;
: set-top
'[ hole-push @ ] callcc1 ; inline
: reset
'[ @ abort-top ] set-top ; inline
:: shift
[| k |
[| x | [ x k continue-with ] set-top ]
quot call abort-top
] callcc1
; inline
Author: | glguy |
Mode: | factor |
Date: | Tue, 7 Apr 2009 18:09:01 |
Plain Text |
IN: delimited-continuations
USING: kernel continuations namespaces sequences fry ;
SYMBOL: Holes
: hole-init
V{ } clone Holes set ;
: hole-push
Holes get push ;
: hole-pop
Holes get pop ;
: abort-top
hole-pop continue-with ;
: set-top
'[ hole-push @ ] callcc1 ; inline
: reset
'[ @ abort-top ] set-top ; inline
: shift
'[ @ abort-top ] callcc1 ; inline
: jump
'[ _ _ continue-with ] set-top ; inline
New Annotation