added in another sk test
This commit is contained in:
parent
dc441e79c8
commit
0890e81e3d
|
@ -312,10 +312,10 @@
|
|||
;; foldr
|
||||
;; sort
|
||||
;; build-list
|
||||
;; box
|
||||
box
|
||||
;; box-immutable
|
||||
;; unbox
|
||||
;; set-box!
|
||||
unbox
|
||||
set-box!
|
||||
;; make-hash
|
||||
;; make-hasheq
|
||||
;; hash-set!
|
||||
|
|
|
@ -8,4 +8,5 @@
|
|||
|
||||
(test "hello.rkt")
|
||||
(test "sk-generator.rkt")
|
||||
(test "sk-generator-2.rkt")
|
||||
#;(test "simple-structs.rkt")
|
6
tests/more-tests/sk-generator-2.expected
Normal file
6
tests/more-tests/sk-generator-2.expected
Normal file
|
@ -0,0 +1,6 @@
|
|||
"a"
|
||||
"b"
|
||||
"c"
|
||||
1
|
||||
2
|
||||
3
|
32
tests/more-tests/sk-generator-2.rkt
Normal file
32
tests/more-tests/sk-generator-2.rkt
Normal file
|
@ -0,0 +1,32 @@
|
|||
#lang planet dyoo/whalesong
|
||||
(define (make-gen gen)
|
||||
(let ([cont (box #f)])
|
||||
(lambda ()
|
||||
(call/cc (lambda (caller)
|
||||
(if (unbox cont)
|
||||
((unbox cont) caller)
|
||||
(gen (lambda (v)
|
||||
(call/cc (lambda (gen-k)
|
||||
(begin
|
||||
(set-box! cont gen-k)
|
||||
(caller v))))))))))))
|
||||
|
||||
(define g1 (make-gen (lambda (return)
|
||||
(begin
|
||||
(return "a")
|
||||
(return "b")
|
||||
(return "c")))))
|
||||
|
||||
(define g2 (make-gen (lambda (ret)
|
||||
(begin
|
||||
(ret 1)
|
||||
(ret 2)
|
||||
(ret 3)))))
|
||||
|
||||
(g1)
|
||||
(g1)
|
||||
(g1)
|
||||
|
||||
(g2)
|
||||
(g2)
|
||||
(g2)
|
Loading…
Reference in New Issue
Block a user