Jon Wilson wrote:
Is there any sensible way to implement the following semantics:
(+ (values 1 2))
==>
3
>
Or perhaps with a macro of some sort (but preferably as above)...
(+ (values->list-elements (values 1 2)))
==>
3
! untested code !
(define-macro (values->list vs)
`(call-with-values (lambda () ,vs) list))
(apply + (values->list (values 1 2 3)))
or
(define-macro (make-cockeyed-function f)
`(lambda (vs) (apply ,f (values->list vs))))
((make-cockeyed-function +) (values 1 2 3))
The intermediate step (after the macro expansion I guess) would look like
(+ 1 2)
No, this is impossible without redefining +. A macro produces 1 sexp,
not more.
It seems like this would make multiple values much much more useful.
szgyg
ps: GNU Free Software Directory list guile-1.6.7 as recent
_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user