MathGroup Archive 1998

[Date Index] [Thread Index] [Author Index]

Search the Archive

AbsoluteLevel again



Hello, 

Thanks to everybody who suggested  solutions for AbsoluteLevel.
Unfortunatelly, I did not manage to express want I actually want. Here
is one more try.

I define a function:

foo[a_,b_]:=bar[a,b]/;(FindAbsoluteLevel[a]<2)

Where "FindAbsoluteLevel "
, as Daniel Lichtblau noted, is a nesting-depth-counter in respect to
outermost level of evaluation at that particular moment, when  pattern
matching occurs. (of course  pattern matching occurs at some  Level. I
only want to KNOW  at which Level it sits at that moment)

When applied to :

foo[a,b[foo[c,d]]]

I want the  the following substitution take place

bar[a,b[foo[c,d]]]

because only "a"  is at Level one:

Level[foo[a,b[foo[c,d]]],1]

Out[10]=
{a,b[foo[c,d]]}

I suspect (as Dave Withoff noted) that I could never use this 
FindAbsoluteLevel if I climb to the outermost  Level. So is it 
possible to have such a function? Can I know evaluation level at the 
moment without evaluation the whole expression? Actually I want to 
return to the point of evaluation after checking condition.

I want to note that there is no probllem at all to replace inner foo[]: 
simply check FreeQ[]. I want to replace outermost foo[]  and associate
the replacemant rule with name foo!


                                      Arturas Acus
Institute of Theoretical
Physics and Astronomy
Gostauto 12, 2600,Vilnius
Lithuania 


E-mail: acus@itpa.lt
   Fax: 370-2-225361
   Tel: 370-2-612906



  • Prev by Date: ValueList command
  • Next by Date: mathematica xpm
  • Prev by thread: Re: ValueList command
  • Next by thread: mathematica xpm