[plt-scheme] match multiple values

From: Robert Nikander (nikander at nc.rr.com)
Date: Fri May 4 12:16:03 EDT 2007

Hi all,

Is there a way to use match, match-let, etc, with (values v ...).  
Something like this:

(match (values 1 2)
  ((a b) b))
=> 2

Related question: since we have the ML-style binding forms in "match.ss" 
and "plt-match.ss", is there a reason to prefer returning (values v ...) 
from a function, as opposed to a list or vector or something else?  It 
looks to me like the "values" form was invented to have a way to return 
multiple values without making the caller explicitly take apart a list.  
The match forms seems so much better at that, but many standard 
functions return (values v ...).

Rob





Posted on the users mailing list.