Re: SRFI 182: ADBMAL, ALET, and ALET* Joo ChurlSoo (11 Mar 2020 04:52 UTC)
Re: SRFI 182: ADBMAL, ALET, and ALET* Marc Feeley (11 Mar 2020 14:01 UTC)
Re: SRFI 182: ADBMAL, ALET, and ALET* Joo ChurlSoo (11 Mar 2020 23:50 UTC)

Re: SRFI 182: ADBMAL, ALET, and ALET* Marc Feeley 11 Mar 2020 14:01 UTC

> On Mar 11, 2020, at 12:52 AM, Joo ChurlSoo <xxxxxx@gmail.com> wrote:
>
>
> | For example:
> | (define x 1)
> | (define y 2)
> | (define a (adbmal x y))
> | (define a* (adbmal* x y))
> | (define v (values x y))		error:racket
> | (define v* (lambda () (values x y)))
> | (define listxy (lambda (x y) (list x y)))
>
> | (a listxy)        	       	= (1 2)
> | (a* listxy)      	      	= (1 2)
> | (call-with-values v listxy)  	error
> | (call-with-values v* listxy)    = (1 2)
> | (receive (x y) v (list x y))	error or (1 2):gambit
> | (receive (x y) v* (list x y))	error
> | (receive (x y) (v*) (list x y)) = (1 2)
>
> | (set! x 10)
> | (set! y 20)
> | (a listxy)	       	       	= (10 20)
> | (a* listxy)      	      	= (1 2)
> | (call-with-values v* listxy)    = (10 20)
> | (receive (x y) (v*) (list x y)) = (10 20)
> | (receive (x y) v (list x y))	error or (1 2):gambit
>
> By the way, which do you think is correct, racket or gambit?

Actually both… a Scheme implementation is free to do what it wants when the standard says “it is an error”.  Here Gambit allows values that are “multiple values” to be stored in variables.  This is convenient in various situations that need to handle multiple values as an aggregate.

Marc