[Tfug] 64 bit file server? NOW: Semi-off-subject programming language discussion?

Chris Niswander cn.tfug.account at bitboost.com
Sat Jul 9 16:49:05 MST 2005


At 02:13 AM 7/9/2005 -0700, you wrote:
>On 7/8/05, Stephen Hooper <schooper at email.arizona.edu> wrote:
>> That is understandable, but it did not properly connote the meaning that
>> I was trying for (which was that the "/mod" is a single operation that
>> returns both pieces of information).
>
>only a few languages can return multiple values as opposed to a
>list or vector.  most people don't know about it.  it is efficient
>and sometimes elegant.  certainly it feels wrong to have to,
>say, decode the time into year, month, date, etc. using
>multiple calls.  memoization is too kludgey a fix.

I know that I sometimes enjoy efficiency and elegance benefits
from this ability in Python, wherein a function can make multiple
return values available, and the caller has the option to use them.

def somecrap(a, b, c):
  #...
  return result, fussydetails
#...
x, y = somecrap(2, [7, 'a', "Avacado"], 4)

I see that some other languages said to support multiple return values
  (see e.g. http://plg.uwaterloo.ca/~rgesteve/cforall/multiple.html)
include Postscript, Euler, and some versions of LISP.

And of course, Perl kind of supports multiple return values, in an
everything-gets-smooshed-into-a-single-flattened-list-sorry-if-you-
were-fond-of-full-support-for-real-data-structures kind of way.

Chris




More information about the tfug mailing list