Re: question about values

2020-03-18 Thread Massimiliano Gubinelli
Thanks Taylan, > On 18. Mar 2020, at 07:12, Taylan Kammer wrote: > > 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 valu

Re: question about values

2020-03-18 Thread Massimiliano Gubinelli
Let me precise my concerns. I know I can do (begin (initialization-code) (let ((vals (call-with-values (lambda () (bar)) (lambda vals vals (finalization) (apply values vals))) this is the hack I'm using now in my code. But my question is: does it incur performance penalties (it will

Re: question about values

2020-03-18 Thread Matt Wette
On 3/18/20 2:55 AM, Massimiliano Gubinelli wrote: I understand the point but then it comes to the problem how to handle this in macros. For example if bar is a proceduce which returns multiple values and I have a macro "my-macro" which wraps the call with some initialization and finalization

Re: question about values

2020-03-18 Thread Massimiliano Gubinelli
> On 18. Mar 2020, at 13:39, Matt Wette wrote: > > > How about calling (my-macro/values bar) where my-macro/values expands to > > (call-with-values (lambda () (bar)) > (lambda args (finalization-code) (apply values args)) > > Matt > > Yeah! I like this better. But still wraps and unwrap

Re: question about values

2020-03-18 Thread John Cowan
There is going to be a performance penalty, because you are taking multiple values (which is not a value) and making it into a value by creating a list. There is no getting away from that except to exclude multiple values. Note also that if the procedure throws an exception, your finalizer will n

Re: question about values

2020-03-18 Thread Massimiliano Gubinelli
Good point with dynamic-wind. Does it pass along also multiple values or has the same problem? m > On 18. Mar 2020, at 15:06, John Cowan wrote: > > There is going to be a performance penalty, because you are taking multiple > values (which is not a value) and making it into a value by creati

Re: question about values

2020-03-18 Thread Massimiliano Gubinelli
> On 18. Mar 2020, at 15:40, Massimiliano Gubinelli > wrote: > > Good point with dynamic-wind. Does it pass along also multiple values or has > the same problem? > Does not work... mgubi@Ulrike guile3-usr % bin/guile GNU Guile 3.0.1 Copyright (C) 1995-2020 Free Software Foundation, Inc. G

Re: question about values

2020-03-18 Thread tomas
On Wed, Mar 18, 2020 at 03:48:03PM +0100, Massimiliano Gubinelli wrote: > > > On 18. Mar 2020, at 15:40, Massimiliano Gubinelli > > wrote: > > > > Good point with dynamic-wind. Does it pass along also multiple values or > > has the same problem? > > > > Does not work... > > mgubi@Ulrike gui

Re: question about values

2020-03-18 Thread Massimiliano Gubinelli
Yes. Sorry. My bad, I had coded by copy&paste my previous example and is obviously not going to work. Indeed dynamic-wind works as it should: mgubi@Ulrike guile3-usr % bin/guile GNU Guile 3.0.1 Copyright (C) 1995-2020 Free Software Foundation, Inc. Guile comes with ABSOLUTELY NO WARRANTY; for