[Bese-devel] bese continuations

Marco Baringer mb at bese.it
Sat Nov 12 12:10:33 UTC 2005


karol skocik <karol.skocik at gmail.com> writes:

>  I hope, somebody will write me example with this functionality :
>
> (dotimes (i 10)
>  ;; here I want to save the continuation to *variable*
>  ;; here I want to return 'i')

; loading system definition from /Users/mb/lisp/systems/arnesi.asd into #<Package "ASDF333">
; registering #<SYSTEM :ARNESI #x851E986> as ARNESI
; registering #<SYSTEM :ARNESI.TEST #x852ED0E> as ARNESI.TEST
; registering #<SYSTEM :ARNESI.CL-PPCRE-EXTRAS #x8528236> as ARNESI.CL-PPCRE-EXTRAS
CL-USER> 
CL-USER> 
ARNESI> (defvar *k* nil)
*K*
ARNESI> (with-call/cc
          (dotimes (i 3)
            (let/cc k
              (setf *k* k)
              i)))
0
ARNESI> (kall *k*)
1
ARNESI> (kall *k*)
2
ARNESI> (kall *k*)
NIL
ARNESI> (kall *k*)
4
ARNESI> 

so that't how you'd do it, and it'd work to if openmcl's
implementation of dotimes to continuations into account :)

-- 
-Marco
Ring the bells that still can ring.
Forget the perfect offering.
There is a crack in everything.
That's how the light gets in.
	-Leonard Cohen



More information about the bese-devel mailing list