[plt-scheme] passing multiple "values" between functions
Here are two alternatives that work:
#lang scheme
(define (foo)
(values 1 2))
(define (bar inp)
(let-values ([(x y) inp])
(list x y)))
(define (baz x y)
(list x y))
(call-with-values foo baz)
(define (moo f)
(let-values ([(x y) (f)])
(list x y)))
(moo foo)
-- Matthias
On Apr 6, 2009, at 2:53 AM, Martin DeMello wrote:
> If I have a function returning two values, how do I write a function
> that consumes them? Two failed tries below, to explain what I'm
> attempting.
>
> #lang scheme
>
> (define (foo)
> (values 1 2))
>
> (define (bar inp)
> (let-values ([(x y) inp])
> (list x y)))
>
> (define (baz x y)
> (list x y))
>
> ;(bar (foo))
> ;(baz (foo))
> _________________________________________________
> For list-related administrative tasks:
> http://list.cs.brown.edu/mailman/listinfo/plt-scheme