strict check whether given expression is multiple value or not
This commit is contained in:
parent
7fe6a5007c
commit
45fb1be04f
|
@ -261,16 +261,18 @@
|
||||||
(picrin macro)
|
(picrin macro)
|
||||||
(picrin core-syntax))
|
(picrin core-syntax))
|
||||||
|
|
||||||
|
(define *values-tag* (cons #f '()))
|
||||||
|
|
||||||
(define (values . args)
|
(define (values . args)
|
||||||
(if (and (pair? args)
|
(if (and (pair? args)
|
||||||
(null? (cdr args)))
|
(null? (cdr args)))
|
||||||
(car args)
|
(car args)
|
||||||
(cons '*values-tag* args)))
|
(cons *values-tag* args)))
|
||||||
|
|
||||||
(define (call-with-values producer consumer)
|
(define (call-with-values producer consumer)
|
||||||
(let ((res (producer)))
|
(let ((res (producer)))
|
||||||
(if (and (pair? res)
|
(if (and (pair? res)
|
||||||
(eq? '*values-tag* (car res)))
|
(eq? *values-tag* (car res)))
|
||||||
(apply consumer (cdr res))
|
(apply consumer (cdr res))
|
||||||
(consumer res))))
|
(consumer res))))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue