RE: Re: Beginner--How to simulate multiple returns for a function?
- To: mathgroup at smc.vnet.net
- Subject: [mg66470] RE: [mg66444] Re: Beginner--How to simulate multiple returns for a function?
- From: "David Park" <djmp at earthlink.net>
- Date: Sun, 14 May 2006 02:58:26 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Robert,
Mathematica understands 'multiple binding' also. If a routine returns a list
it can be assigned to a list.
{a,b,c} = Calculateabc[parms...]
One could also make the Calculateabc routine assign the values internally
but then it would be necessary to pass the symbol names so I would think it
is easier to do it as above.
David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/
From: Robert Dodier [mailto:robert.dodier at gmail.com]
To: mathgroup at smc.vnet.net
Jens-Peer Kuska wrote:
> what are multiple returns ?
Probably what the original poster wants is not just to return a list,
but to return a list and assign its elements to multiple variables.
E.g. Python understands the following
(A, B, C) = (1, 2, 3)
to mean A = 1, B = 2, C = 3. Lisp has several similar constructs
(MULTIPLE-VALUE-BIND and so on).
Of course it would help if people would just come right out and
say what they want.
FWIW
Robert Dodier