Hello, some clarifications below
On 08/21/2013 05:19 AM, Doug McNutt wrote: >> ***** a "function" is a subroutine returning a scalar ( see below) fwiw we don't make that distinction in the specification; we just talk about subroutines. We can return nothing, a scalar or a non-scalar. >>, a "procedure" is a subroutine with no >>return value, side-effects only. A subroutine returning many values- a >>parcel of containers, perhaps, or an iterator, etc- is a >>"many-to-many" relation. I understand "relational algebra" from >>decades of SQL work, and have seen ORM's replicate relations in object >>systems with some success. What's missing for creating a relational >>wonderland in perl6? > > > I confess. I'm here because I hoped perl 6 would do vector operations after > reading an early small book. And it does, if you teach it to. Perl 6 has some facilities to spread out operations over lists of elements, though not all operations common in linear algebra (vector cross product, multiplying a vector with a matrix etc.) are built-in. Just like they aren't built into Fortran, for that matter. > I would really like to see perl support a function called a cross product > that would return a vector, the product of amplitudes and the sine of the > angle between them, as a vector using the <> notation. That's not a scalar! > But i surely would be commensurate with the input arguments. Please don't fall prey to some mismatch in terminology. In Perl 6, a scalar is just some form of container, which happens to be used in variables beginning with a dollar ($). Nothing stops you from putting a vector, however you define or declare one, into a scalar (variable). Nor is there any restriction that makes it impossible to return more than one value from a subroutine -- it just happens to be the case that yary's definition of "function" restricts functions to one value. But that's really a matter of terminology, not technology. Cheers, Moritz