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 15:02:40 +0200
Dear list,
I have a function that must perform some operations on a matrix, and
it should output something like "matrix m modified", where m is the
name of the matrix.
f(m) := (
some code...,
print("Matrix", name_of_m, "modified")
)$
I don't know how to assign the name of the matrix, for example
"matrix1", to the other variable name_of_m, or how to print the name
directly inside the function. So, the output should be:
(%i1) f(matrix1);
(%o1) Matrix matrix1 modified
I cannot figure out how to do it, please excuse if it is a trivial question.
Stefano