matrix implementation, was: patch for $addrow needed?
Subject: matrix implementation, was: patch for $addrow needed?
From: Jaime E. Villate
Date: Fri, 21 Apr 2006 11:27:53 +0100
On Thu, 2006-04-20 at 12:43 -0400, Stavros Macrakis wrote:
> To have value semantics, not only every assignment, but also every
> *argument passing* would require a copy (or some complicated
> copy-on-write scheme). This is sometimes called "deep copy"
> semantics. This would make programming with lists prohibitively
> expensive. Even simply iterating down a list using 'rest' would
> require N copies.
and notice that we already have a way to define another list, equal
to the first one, in a way that they remain independent:
L1: [2,3,4]$
L2: L1$
L3: copylist(L1)$
L2[1]:10$ /* Modifies L1 and L2, but not L3 */
therefore, I think we should keep the current behavior and document
it better in the documentation, referring to "copylist". It would
be nice to have also a function "copymatrix"; as long as I can tell
there is not such thing in the current version.
I can accept the first task (improving the documentation)
but the second one (writing a copymatrix function) I'd rather
leave it to a more experience lisp programmer.
Jaime