MathGroup Archive 2002

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

Search the Archive

looking for a "test[ 1, ALL ]

  • To: mathgroup at smc.vnet.net
  • Subject: [mg38373] looking for a "test[ 1, ALL ]
  • From: Oliver Ruebenkoenig <ruebenko at donne.imtek.uni-freiburg.de>
  • Date: Fri, 13 Dec 2002 04:09:23 -0500 (EST)
  • Organization: Rechenzentrum der Universitaet Freiburg, Germany
  • Sender: owner-wri-mathgroup at wolfram.com

Hi Mathgroup,

consider the following:

In[1]:=	test[1, 1] = a;
	test[1, 3] = b;

In[2]:= ?test
Global`test

test[1, 1] = a
 
test[1, 3] = b

In[3]:=	from := 1;
	to := 3;
	test[ 1, #1 ] & /@ Range[ from, to ]

Out[5]= {a, test[1, 2], b}

Of course the test[ 1, 2 ] is not evaluated; it does not exist. If I want
to delete the existing ones I could use:

In[9]:= deletableValue := 1;
	( HoldForm[ test[ deletableValue, #1 ]  =. &  ] /@ 
      		Range[ from, to ] ) // ReleaseHold

Unset::norep: Assignment on test for test[1, 2] not found.

Out[10]= {Null, $Failed, Null}

Which makes sense. 

In[14]:= ?test      
Global`test

No "test" in the global context. My question now: is there a mechanism
e.g. something like test[ 1, All ] that does only access the existing
test?

I am aware of the possibility to use a conditional (If, Case, ..) and
DownValues to avoid the error message, but is there a more direct
(faster?) way?

Thanks a lot for you comments,

Oliver


Oliver Ruebenkoenig, <ruebenko at imtek.de>
   Phone: ++49 +761 203 7293



  • Prev by Date: Pure recursive functions
  • Next by Date: Re: Pure recursive functions
  • Previous by thread: Marquardt & Levenberg Method Theoretical Origins
  • Next by thread: RE: looking for a "test[ 1, ALL ]