mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-12 15:27:36 +02:00
Simple version of call-with-values
This commit is contained in:
parent
163d399f07
commit
14f42a0b5a
1 changed files with 8 additions and 8 deletions
|
@ -322,16 +322,16 @@
|
|||
(if (and (not (null? args)) (null? (cdr args)))
|
||||
(car args)
|
||||
(cons (cons 'multiple 'values) args))))
|
||||
(define call-with-values
|
||||
(lambda (producer consumer)
|
||||
(let ((x (producer)))
|
||||
(if ;(magic? x)
|
||||
(and (pair? x) (equal? (car x) (cons 'multiple 'values)))
|
||||
(apply consumer (cdr x))
|
||||
(consumer x)))))
|
||||
|
||||
;; TODO: just need something good enough for bootstrapping (for now)
|
||||
;; does not have to be perfect (this is not, does not handle call/cc or exceptions)
|
||||
; (define call-with-values
|
||||
; (lambda (producer consumer)
|
||||
; (let ((x (producer)))
|
||||
; (if ;(magic? x)
|
||||
; (and (pair? x) (equal? (car x) (cons 'multiple 'values)))
|
||||
; (apply consumer (cdr x))
|
||||
; (consumer x)))))
|
||||
|
||||
(define (dynamic-wind before thunk after)
|
||||
(before)
|
||||
(let ((result (thunk)))
|
||||
|
|
Loading…
Add table
Reference in a new issue