Arrays in LC [was: Re: [TAO] value() to obtain pointer functionality]

Richard Gaskin ambassador at fourthworld.com
Wed Aug 20 09:57:15 EDT 2014


Peter Haworth wrote:

 > On Tue, Aug 19, 2014 at 5:35 PM, Alex Tweedly wrote:
 >
 >> But you get them (I think) just with "add", etc.
 >
 > Yes, thanks Alex, I missed that.  It seems that multiply also works
 > that way so I guess the matrixMultiply command must be like the
 > transpose command - works on the old style arrays only.  I wonder
 > why they don't mark those commands a deprecated?

Because they still work and are supported for the foreseeable future.

It may be convenient to extend the behavior of matrixMultiply to wok on 
multidimensional arrays, but given that the current behavior is in use 
it would be wise to continue supporting it.

Matrices are not necessarily arrays; the reason there's a matrixMultiply 
but not matrixAdd, matrixSubtract, etc. is because matrix multiplication 
is commonly used as part of a larger sequence of analytics operations 
across a data set, not just as a convenience for doing arithmetic on 
individual values that just happen to be grouped together in a single 
variable.

Many years ago nearly Jeanne Devoto exhausted herself trying to explain 
to my math-challenged self why matrixMultiply was useful while other 
seemingly-similar arithmetic operations much less so, but ultimately 
gave up and merely pointed me to this Wikipedia page - it offers a much 
better explanation of how matrix multiplication is used than I could offer:

<http://en.wikipedia.org/wiki/Matrix_multiplication>

In short, if someone wants to submit an enhancement request for either 
matrixMultiply to work on multiple dimensions when present, or an 
arrayMultiply if that's what's being sought, that could be very useful 
as long as any such extensions to the language continue to support 
existing code relying on current behavior.

-- 
  Richard Gaskin
  Fourth World Systems
  Software Design and Development for the Desktop, Mobile, and the Web
  ____________________________________________________________________
  Ambassador at FourthWorld.com                http://www.FourthWorld.com




More information about the use-livecode mailing list