There is another way to set up memoizing, based on what
Maple does. Unfortunately it is inherently buggy, and is
a regular source of bugs and unexpected behavior in Maple.
(1) Have a "remember" option on functions, so that if they
are called a second time with the same arguments, they return
the previously computed answer.
(2) Have a "forget" operation that makes a function forget.
(3) Let the user beware.
Typical screwups in Maple: compute a memoized function
of some numerical kind. increase the precision by doing
decimals:= 2* decimals or some such thing. recompute
and get the same answer instead of a more precise answer.
RJf
Pedro Fortuny wrote:
> My guesses are (from the way I have been using graphs):
>
> a) Create two kind of functions: one destructive and the other one
> non-destructive. For example (assuming g is a "graph_thing")
>
> g2 : add_edge(g,[1,2]);
> g2 : add_edgeD(g,[1,2]);
>
> The first one could create a new graph and preserve g (and all the
> information) while the second one could create g2 destroying g (making it
> garbage).
>
> b) Create functions which tell the program whether to keep the info into
> the graph or not:
>
> M : adjacency_matrix(g);
> M : adjacency_matrixK(g);
>
> The first could simply return the adj. matrix, while the second could
> store it in your "graph" structure or in a hash table, or any way you
> want.
>
> Merry Christmas to everybody,
>
> Pedro.
>
>
> Pedro Fortuny Ayuso -------------> http://pfortuny.sdf-eu.org
> School of Mathematical Sciences. Queen Mary College, Univ. London
> Mile End Road, London E1 4NS, UK ------> www.qmul.ac.uk
> pfortuny@sdf-eu.org Tfn. Nr. 44 20 7882 5493
>
>
> _______________________________________________
> Maxima mailing list
> Maxima@www.math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima