Implement let-values
TODO: Support more than one set of bindings
This commit is contained in:
parent
573d02ac64
commit
738f8bec62
File diff suppressed because it is too large
Load Diff
|
@ -515,6 +515,15 @@
|
||||||
`(call-with-values (lambda () ,expr)
|
`(call-with-values (lambda () ,expr)
|
||||||
(lambda ,formals ,@body)))
|
(lambda ,formals ,@body)))
|
||||||
|
|
||||||
|
(define-macro (let-values bindings . body)
|
||||||
|
(unless (pair? bindings) (error "let-values: syntax error"))
|
||||||
|
(let* ((binding (car bindings))
|
||||||
|
(names (car binding))
|
||||||
|
(form (cadr binding)))
|
||||||
|
(unless (null? (cddr binding)) (error "let-values: syntax error"))
|
||||||
|
(unless (null? (cdr bindings)) (error "let-values: syntax error"))
|
||||||
|
`(receive ,names ,form ,@body)))
|
||||||
|
|
||||||
(define-macro (dotimes var . body)
|
(define-macro (dotimes var . body)
|
||||||
(let ((v (car var))
|
(let ((v (car var))
|
||||||
(cnt (cadr var)))
|
(cnt (cadr var)))
|
||||||
|
|
Loading…
Reference in New Issue