Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'Is it possible to PARTIALLY evaluate an expression?' topicStudent Support Forum > General > "Is it possible to PARTIALLY evaluate an expression?"

Next Comment >Help | Reply To Topic
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: ,

Subject (listing for 'Is it possible to PARTIALLY evaluate an expression?')
Author Date Posted
Is it possible to PARTIALLY evaluate an express... Mark W 07/12/99 8:54pm
Re: Is it possible to PARTIALLY evaluate an exp... Forum Modera... 07/12/99 9:26pm
Really, my main concern is to assign the rights... Mark W 07/16/99 05:26am
Re: Really, my main concern is to assign the ri... Forum Modera... 07/16/99 05:42am
Re: Really, my main concern is to assign the ri... Bruno 07/28/99 09:28am
Re: Really, my main concern is to assign the ri... Bruno 08/02/99 12:32pm
Next Comment >Help | Reply To Topic