MathGroup Archive 1998

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

Search the Archive

partially delayed evaluation

  • To: mathgroup at smc.vnet.net
  • Subject: [mg13421] partially delayed evaluation
  • From: john at dlugosz.com (John M. Dlugosz)
  • Date: Thu, 23 Jul 1998 03:33:16 -0400
  • Abuse-reports-to: abuse at airmail.net to report improper postings
  • Organization: at home
  • Sender: owner-wri-mathgroup at wolfram.com

f[m,n] := (
   ...
   f[m,n] :=  Function[countone[p1]];  (* remember *)
   ...
   )


When f is computed, it also records a special case as a "cache" for next
time, as illustrated early on in the Big Book.

However, I don't just want to return the computed value p1, so I can't 
say   f[m,n]=p1 .  I also want it to have a run-time effect, so for 
simplicity I defined the function countone which does the effect and 
returns its argument unchanged.

So, I want to build a function which when called calls countone, but the
argument p1 has to be evaluated when the Function is built.

I see this being done with low-level list manipulation so I can control 
just what gets evaluated ahead of time and what doesn't.

Could someone please show me just how to do this?

--John

		


  • Prev by Date: Re: Q: Graphics3D
  • Next by Date: Undocumented 3.0 Features
  • Previous by thread: Re: programming in Mathmatica
  • Next by thread: Undocumented 3.0 Features