From: Chris Hanson Date: Mon, 8 Jul 2019 19:34:09 +0000 (-0400) Subject: Change multiple-value return to be slighly closer to correct. X-Git-Tag: mit-scheme-pucked-10.1.12~7^2~16 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=4383801e6e05d2b5b3a3dcf274e410e2f42ce8b8;p=mit-scheme.git Change multiple-value return to be slighly closer to correct. It's never going to be correct, but this at least permits mixing single values and multiple values a bit. --- diff --git a/src/runtime/global.scm b/src/runtime/global.scm index ba9a00374..e9a6675d4 100644 --- a/src/runtime/global.scm +++ b/src/runtime/global.scm @@ -129,12 +129,22 @@ USA. (define bind-cell-contents! (object-component-binder cell-contents set-cell-contents!)) +(define-record-type + (make-multi-values list) + multi-values? + (list multi-values-list)) + (define (values . objects) - (lambda (receiver) - (apply receiver objects))) + (if (and (pair? objects) + (null? (cdr objects))) + (car objects) + (make-multi-values objects))) (define (call-with-values thunk receiver) - ((thunk) receiver)) + (let ((v (thunk))) + (if (multi-values? v) + (apply receiver (multi-values-list v)) + (receiver v)))) (define (write-to-string object #!optional max) (if (or (default-object? max) (not max))