|
From: | Taylan Kammer |
Subject: | Re: question about values |
Date: | Wed, 18 Mar 2020 07:12:51 +0100 |
User-agent: | Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 |
On 18.03.2020 00:50, Massimiliano Gubinelli wrote:
(let ((a (values "a" "b" "c"))) a)
The result of (values x y z) is not a kind of object that contains three values (like a list or vector). It's three separate values that would need to be put into three separate variables. But you're only naming one variable (a). So strictly speaking the code is "wrong".
In Guile 1.8, multiple values were actually put into some special kind of object (which was not very efficient) so code like that still somehow worked even thought it's technically wrong.
Starting from Guile 2.0, providing multiple values in a context where only one is expected causes the extra values to be ignored.
Happy to answer further questions about this. Multiple-values can be a tricky concept to grasp because most other programming languages don't have it.
- Taylan
[Prev in Thread] | Current Thread | [Next in Thread] |