Re: Multiple values passed as single argument to procedure

2017-09-01 Thread Chris Marusich
Earlier, I wrote: > OK. I'll submit a patch later this week to update the manual with > information taken from this email thread. Hopefully that will help > clarify the behavior for others in the future. Please find the promised patch attached. It's still this week, isn't it? :-) As a Guile

Re: Multiple values passed as single argument to procedure

2017-06-26 Thread Alex Vong
Here is an explanation of multiple values by Oleg[0] and an implementation from the Scheme book[1]. These are more advanced stuff. Honestly, I usually don't understand what Oleg said. But it is good to know these references. It is like math, one day when you have enough background and the right

Re: Multiple values passed as single argument to procedure

2017-06-13 Thread dsmich
Mark H Weaver wrote: > David Kastrup writes: > > > Mark H Weaver writes: > >ument > >> I'm sorry David, but _everything_ that you wrote below is incorrect. > > > > Well, let me try again. It's not all that easy to understand. > > You're

Re: Multiple values passed as single argument to procedure

2017-06-12 Thread Mark H Weaver
Mark H Weaver writes: > The reason that (f) is not in tail position with respect to (list (f)) > is because there is still something left to do after calling (f) but > before invoking the continuation of (list (f)). The thing remaining to > do is to apply 'list' to the returned

Re: Multiple values passed as single argument to procedure

2017-06-12 Thread Mark H Weaver
In the discussion about continuation passing style, I forgot to explain the semantics of when and how Guile discards extra return values. It's very simple: I wrote: > Here's what (lambda () (list (f 1) (f 2) (f 3))) looks like in CPS, > using the same evaluation order as I chose above: > >

Re: Multiple values passed as single argument to procedure

2017-06-12 Thread Mark H Weaver
David Kastrup writes: > Mark H Weaver writes: > >> I'm sorry David, but _everything_ that you wrote below is incorrect. > > Well, let me try again. It's not all that easy to understand. You're obviously quite intelligent and knowledgeable, so it's probably my

Re: Multiple values passed as single argument to procedure

2017-06-12 Thread David Kastrup
Mark H Weaver writes: > I'm sorry David, but _everything_ that you wrote below is incorrect. Well, let me try again. It's not all that easy to understand. > David Kastrup writes: > >> Chris Marusich writes: >> >>> I think I'm missing

Re: Multiple values passed as single argument to procedure

2017-06-12 Thread Mark H Weaver
I'm sorry David, but _everything_ that you wrote below is incorrect. David Kastrup writes: > Chris Marusich writes: > >> I think I'm missing something here. In (list (f)), the call to f >> certainly looks like it's happening at a position that one might >>

Re: Multiple values passed as single argument to procedure

2017-06-12 Thread Neil Jerram
On 12/06/17 09:55, Neil Jerram wrote: On 12/06/17 09:19, Chris Marusich wrote: I think I'm missing something here. In (list (f)), the call to f certainly looks like it's happening at a position that one might intuitively call a "tail" position. So, in this case, what disqualifies f from being

Re: Multiple values passed as single argument to procedure

2017-06-12 Thread David Kastrup
Chris Marusich writes: > I think I'm missing something here. In (list (f)), the call to f > certainly looks like it's happening at a position that one might > intuitively call a "tail" position. It is, but list does not take multiple values and thus discards additional

Re: Multiple values passed as single argument to procedure

2017-06-12 Thread Neil Jerram
On 12/06/17 09:19, Chris Marusich wrote: I think I'm missing something here. In (list (f)), the call to f certainly looks like it's happening at a position that one might intuitively call a "tail" position. So, in this case, what disqualifies f from being in tail position? Can you give me an

Re: Multiple values passed as single argument to procedure

2017-06-12 Thread Chris Marusich
Hi Mark, Regarding the Guile-specific behavior where passing multiple values as an argument to a procedure causes only the first value to be used as the argument: > I would recommend against relying on this behavior, mainly because I > would consider it a bit sloppy. However, I also think it's

Re: Multiple values passed as single argument to procedure

2017-06-11 Thread Mark H Weaver
Hi Chris, Chris Marusich writes: > Mark H Weaver writes: > >> Use 'call-with-values', 'let-values', or 'receive' to call a procedure >> that returns multiple values (or no values). >> >> If you do not use one of the above forms (or a macro that expands to

Re: Multiple values passed as single argument to procedure

2017-06-11 Thread Chris Marusich
Hi Mark, Thank you for the detailed response! I learn something new every day. Mark H Weaver writes: > Use 'call-with-values', 'let-values', or 'receive' to call a procedure > that returns multiple values (or no values). > > If you do not use one of the above forms (or a

Re: Multiple values passed as single argument to procedure

2017-06-11 Thread Mark H Weaver
I wrote: > Use 'call-with-values', 'let-values', or 'receive' to call a procedure > that returns multiple values (or no values). > > If you do not use one of the above forms (or a macro that expands to one > of them) to call a procedure that returns multiple values, then Guile > will discard all

Re: Multiple values passed as single argument to procedure

2017-06-11 Thread Mark H Weaver
Chris Marusich writes: > 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? Yes. Scheme has no concept of a "multiple values" object that can be given a single name, or passed as a

Re: Multiple values passed as single argument to procedure

2017-06-11 Thread David Kastrup
Chris Marusich writes: > 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? Yes. > However, I did find the following information in R6RS (Section 5.8: > "Multiple return values"),

Multiple values passed as single argument to procedure

2017-06-11 Thread Chris Marusich
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