Working on better POST and PUT requests
[factor/jcg.git] / extra / partial-continuations / partial-continuations.factor
blob7ec294ca2e9137d5364b774c41481725374c878f
1 ! Copyright (C) 2006 Chris Double.
2 ! See http://factorcode.org/license.txt for BSD license.
3 IN: partial-continuations
4 USING: kernel continuations arrays sequences quotations ;
6 : breset ( quot -- )
7     [ 1array swap keep first continue-with ] callcc1 nip ;
9 : (bshift) ( v r k -- obj )
10     [ dup first -rot ] dip
11     [
12         rot set-first
13         continue-with
14     ] callcc1
15     [ drop nip set-first ] dip ;
17 : bshift ( r quot -- )
18     swap [ ! quot r k
19         over [
20             [ (bshift) ] 2curry swap call
21         ] dip first continue-with
22     ] callcc1 2nip ; inline