= or := ???
- To: mathgroup at smc.vnet.net
- Subject: [mg30668] = or := ???
- From: "Oliver Friedrich" <oliver.friedrich at tz-mikroelektronik.de>
- Date: Mon, 3 Sep 2001 20:32:43 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Hallo,
I'm in trouble with defining a function (in fact at the moment it works the
way I wanted, but with horrible workarounds).
I did some computations which led me to a list rule1={xxx->yyy} with a long
expression.
The next is, that I want to set up a function where expr is modified by
rule1 and then by rule2
function[s_,list_] :={{expr /.% /.zzz->list[[1]]},{expr /.%
/.zzz->list[[2]]},{expr /.% /.zzz->list[[3]]}}
Now for the traps: I want to use rule1 with the % because I don't want to
give that Output a name (never need it again). Now if I define function with
Set, I get the error that PartSpecification list[[_]] is longer than depth
of object (I Know what this error means, no problem about this).
If I define with SetDelayed, I can't use my % notation, because function is
evaluated repeatedly from within any point in my sessions, and I can't rely
on % anymore.
It should work with Set, if I could tell Mathematica that the list_ argument
in function represents a list. How can this be done (define the "type" of of
what a symbol stands for?). I played around with some Hold[] stuff, but
that's not the way, I want to have it.
Any help appreciated !
Oliver Friedrich