Re: Functions with data hidden in them
- To: mathgroup at smc.vnet.net
- Subject: [mg82053] Re: Functions with data hidden in them
- From: Neil Stewart <neil.stewart at warwick.ac.uk>
- Date: Wed, 10 Oct 2007 04:33:14 -0400 (EDT)
- Reply-to: Neil Stewart <neil.stewart at warwick.ac.uk>
Thank you to everyone who replied. Szabolcs Horv=E1t sent a simple solution http://forums.wolfram.com/mathgroup/archive/2007/Oct/msg00205.html The data "5" in "power[5]" is hidden inside the "f[]" function: In[1]:= power[n_][x_] := x^n In[2]:= Format[power[_]] := "--power--" In[3]:= f = power[5] Out[3]= "--power--" In[4]:= f[2] Out[4]= 32 DrMajorBob posted a similar solution. http://forums.wolfram.com/mathgroup/archive/2007/Oct/msg00212.html Hannes Kessler posted a method that avoids recalculation of intermediate values. http://forums.wolfram.com/mathgroup/archive/2007/Oct/msg00224.html Mark Holt posted a trick with the Button[] function. http://forums.wolfram.com/mathgroup/archive/2007/Oct/msg00220.html