How to assign the name of a variable to another variable inside a function
Subject: How to assign the name of a variable to another variable inside a function
From: Stefano Ferri
Date: Fri, 10 Sep 2010 16:08:58 +0200
No, I think. I don't want to change the value of matrix1, but just
assign 'matrix1 to name_of_m.
A clearer example could be:
f(m):=(m:transpose(m),
... here some code to assign a value to name_of_m,
print("Matrix", name_of_m, "transposed)
)$
let
matrix1 : matrix([1,2],[3,4]);
f(matrix1) function should return the tranposed of matrix1, and print
the message
Matrix matrix1 transposed.
I am only able to print out the value of matrix1, not its name.
name_of_m should evaluate to 'matrix1, but if I quote arguments inside
the functions, I get
Matrix m modified.
2010/9/10 Richard Fateman <fateman at cs.berkeley.edu>:
>
>
> name_of_m: matrix1;
> name_of_m:: ?newvalue;
>
> changes the value of matrix1.
>
> Is that what you need?
>
>
>
>
>