From: Christian Neukirchen Date: 2005-05-29T18:02:23+09:00 Subject: Re: Multiple return and parallel assignement Steven Jenkins writes: > Michael Ulm wrote: >> Indeed, strictly speaking, a mathematical function can only have one >> input value. Mathematically, the notation f(x, y) is just a shorthand >> for f([x, y]). > > Thank you. It's a relief to have that cleared up. > >> If Kernigan and Richie had paid more attention at >> math class we would have declarations like >> >> (float, float) transform (float, float) >> >> in C, and the world would be a better place for it :-) > > Dennis Ritchie has a degree in Applied Mathematics from Harvard. Brian > Kernighan was not one of the developers of C, although he co-authored a > famous book with Ritchie. And C functions have been able to return > aggregates for a long time, maybe since the beginning. They're called > structs and unions. Actually, that is not true. See 6.2 of "The C Programming Language" (1st ed): The original K&R C could not return compounds, only their addresses (which is not allowed for "auto" values, not thread-safe for "static" values and needs memory management for allocated values, therefore being totally inconvenient.) This feature must have been added before the 2nd edition (ANSI) was published, though. My german version already knows about it, and that was released in 1983. Then, I can't recall any code offhand that directly returned a structure... For the tuple issue, there is that "great" (ehem...) paper: http://arxiv.org/abs/cs.PL/0504025 > Steve -- Christian Neukirchen http://chneukirchen.org