guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Multiple values passed as single argument to procedure


From: Chris Marusich
Subject: Multiple values passed as single argument to procedure
Date: Sun, 11 Jun 2017 00:56:23 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux)

Hi,

I've noticed that when one passes multiple values as a single argument
to a procedure, only the first value gets used.  Is this expected?
Here's an example:

--8<---------------cut here---------------start------------->8---
$ guile
GNU Guile 2.2.2
Copyright (C) 1995-2017 Free Software Foundation, Inc.

Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
This program is free software, and you are welcome to redistribute it
under certain conditions; type `,show c' for details.

Enter `,help' for help.
scheme@(guile-user)> (define (proc x) x)
scheme@(guile-user)> (proc (values 1 2))
$1 = 1
scheme@(guile-user)> 
--8<---------------cut here---------------end--------------->8---

I've looked in a few places to try to figure out the answer to this
question, but I haven't found much.  In addition to the guile-devel and
guile-user email list archives, I've checked the following sections in
the manual:

(guile) Binding Multiple Values
(guile) Lambda
(guile) Fly Evaluation
(guile) Compiled Procedures
(guile) Expression Syntax

However, I did find the following information in R6RS (Section 5.8:
"Multiple return values"), which seems possibly relevant:

"Not all continuations accept any number of values. For example, a
continuation that accepts the argument to a procedure call is guaranteed
to accept exactly one value.  The effect of passing some other number of
values to such a continuation is unspecified."

-- 
Chris

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]