From: Michael Ulm Date: 2005-05-23T17:23:38+09:00 Subject: Re: Multiple return and parallel assignement Robert Klemme wrote: > Ralph "PJPizza" Siegler wrote: > >>On Sat, May 21, 2005 at 01:30:13AM +0900, James Britt wrote: >> >>>Eric Mahurin wrote: >>> >>>>I've never quite understood why most languages inherently >>>>support returning only a single value >>> >>> >>>Conceptual elegance? >>> >>>Seems cleaner to say that every expression returns an object, though >>>that the object may be a container for other objects, rather than >>>assert that expressions may return an unknown number of objects >>> >>> >>>James >>> >> >>I also think it may be from the original mathematical idea of a >>"function', which only has 1 output value for a given set of inputs, > > > Mathematical functions are in no way limited to yielding a single output > value. > But they are. A (mathematical) function f: M -> N from a set M to a set N is usually defined as a subset of M x N such that for each element m in M there exists exactly one element n in N such that the pair (m, n) is in the subset; one then writes f(m) = n. > >>which 3rd generation programming languages adopted as paradigm. With >>multiple return values, more in the mindset of a "relation", an n to >>m mapping > > > That's what a mathematical function is basically. Don't let sin, cos, > max, min etc. fool you on this one. :-) Maybe you are thinking of vector valued functions, where the return value is a vector? In that case, one still has only one return value (the vector) which in turn contains other elements. This is very similar to returning an array in ruby. Regards, Michael -- Michael Ulm R&D Team ISIS Information Systems Austria tel: +43 2236 27551-219, fax: +43 2236 21081 e-mail: michael.ulm@isis-papyrus.com Visit our Website: www.isis-papyrus.com