strict check whether given expression is multiple value or not

This commit is contained in:
Yuichi Nishiwaki 2013-12-10 08:14:14 -08:00
parent 7fe6a5007c
commit 45fb1be04f
1 changed files with 4 additions and 2 deletions

View File

@ -261,16 +261,18 @@
(picrin macro)
(picrin core-syntax))
(define *values-tag* (cons #f '()))
(define (values . args)
(if (and (pair? args)
(null? (cdr args)))
(car args)
(cons '*values-tag* args)))
(cons *values-tag* args)))
(define (call-with-values producer consumer)
(let ((res (producer)))
(if (and (pair? res)
(eq? '*values-tag* (car res)))
(eq? *values-tag* (car res)))
(apply consumer (cdr res))
(consumer res))))