| Author |
Comment/Response |
Mark W
|
07/12/99 8:54pm
I want to do the following:
Given a Symbol ''name'' and a List of symbols ''list'',
I want to assign
name[symbols in list]=something.
I also want to create the equality
name[symbols in list]==something
after performing the above assignment.
Example:
Given mark and {a,b}, I want to assign mark[a,b]=5 and then create the equality mark[a,b]==5.
I have tried many variations of the following:
funct[name:_Symbol,list:{__Symbol}]:=
Module[{equationName},
equationName=name@@list;
Evaluate[equationName]=5;
Return[Evaluate[equationName]==5];
];
Evaluating funct[mark,{a,b}]...
The first time through, mark[a,b] is correctly assigned 5, but the function returns True, because Evaluate[equationName] evaluates to 5 in the Return.
Is there any way I can get a hold of mark[a,b] within the function? In other words, I only want to partially evaluate equationName to mark[a,b] not the contents of mark[a,b], which is 5.
Along the same lines, evaluating the function a second time generates the
Set::setraw: Cannot assign to raw object 5.
error because mark[a,b] now contains 5 and the Module tries to perform 5=5.
Thanks,
-Mark W
URL: , |
|