This is the mail archive of the guile@cygnus.com mailing list for the guile project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
On 04-Feb-98 Sascha Ziemann wrote: >Hi, > >Guile-GTK needs multiple return values. Does this exist already or are >there plans to implement it? How about a multi-let or multi-set like > >(define (give-two) > (list 5 7)) > >(multi-let (((a b) (give-two))) > (display a) ; => 5 > (display b) ; => 7 > ) I don't think guile needs multiple return values at all. The already existing and very clean way to do it is to use continuation passing style: (define (take-two a b) (define (give-two) (take-two 5 7)) (display a) (display b)) If you don't like the scoping, move give-two outside of take-two's scope (define (give-two taker) (taker 5 7)) and pass take-two as an argument to give-two. And if give-two has to be a thunk, just make one: (define (thunk) (give-two take-two)) (I don't much like defines, lambda's are more clear, but your's was in defines so...)