Skip to Content.
Sympa Menu

patterns-discussion - [patterns-discussion] Source for recursive evaluation pattern?

patterns-discussion AT lists.cs.illinois.edu

Subject: General talk about software patterns

List archive

[patterns-discussion] Source for recursive evaluation pattern?


Chronological Thread 
  • From: "andrew cooke" <andrew AT acooke.org>
  • To: patterns-discussion AT cs.uiuc.edu
  • Subject: [patterns-discussion] Source for recursive evaluation pattern?
  • Date: Sun, 26 Mar 2006 10:25:26 -0400 (CLT)
  • Importance: Normal
  • List-archive: <http://lists.cs.uiuc.edu/pipermail/patterns-discussion>
  • List-id: General talk about software patterns <patterns-discussion.cs.uiuc.edu>


Hi,

I'm trying to find a decription of what I believe is a common pattern in
numerical computation (and possibly occurs in a modified form in language
evaluation), but don't know how to get started. Given the description
below does anyone know what it might be, or alternatively, can anyone
point me at a way for finding patterns? I hope this is an appropriate use
of this list.

Thanks,
Andrew

The aim of the pattern is to evaluate a number of expressions which are
defined in terms of each other and some shared state.

For example, the shared state may be the parameters of a model that is
being optimised, and the expressions calculate observed quantities used to
assess the model against measurements.

The structure of the pattern separates the expressions from a central
"environment" that includes the state, a cache of evaluated expressions,
and an "evaluator".

Evaluation is driven by requesting the expression values from the
evaluator in the environment. The evaluator checks the cache and, if the
expression is not yet known, passes the environment to the expression.
The expression then requests the values it needs from the evaluator,
calculates its own value, and returns.

The action of requesting values from the environment/evaluator may cause
other expressions to be evaluated and cached, recursively.

The advantages of the pattern are:
- separating the state from the expressions gives easy extension
- the automatic resolution of dependencies between expressions
- efficient evaluation via caching

The main risk is a circular loop where two expressions depend each on the
other. One way to avoid this is to force the initial system to be
constructed incrementally with no forward references.

I'm looking for a description because I'm curious about the bst way to
structure some details - what is the best way to relate teh evaluator and
cache, and should the expressions and state share the same API for access
- as well as a reference to pass to colleagues when they look at the code
and ask what's happening.




  • [patterns-discussion] Source for recursive evaluation pattern?, andrew cooke, 03/26/2006

Archive powered by MHonArc 2.6.16.

Top of Page