diff --git a/changelog b/changelog index 6aa90a8..0f1d325 100644 --- a/changelog +++ b/changelog @@ -1,3 +1,6 @@ +20091028 tpd src/axiom-website/patches.html 20091028.01.rhx.patch +20091028 tpd src/input/Makefile add cachedf.input +20091028 rhx src/input/cachedf.input added 20091027 tpd src/axiom-website/patches.html 20091027.03.tpd.patch 20091027 tpd src/interp/interp-proclaims migrate functions to boot package 20091027 tpd src/interp/vmlisp migrate functions to boot package diff --git a/src/axiom-website/patches.html b/src/axiom-website/patches.html index f81c816..41bde76 100644 --- a/src/axiom-website/patches.html +++ b/src/axiom-website/patches.html @@ -2179,5 +2179,7 @@ src/interp/vmlisp.lisp remove vmlisp package, conditionals
slam, buildom, interp-proclaims remove vmlisp
20091027.03.tpd.patch src/interp/vmlisp migrate functions to boot package
+20091028.01.rhx.patch +src/input/cachedf.input added
diff --git a/src/input/Makefile.pamphlet b/src/input/Makefile.pamphlet index e4d7708..0d879e9 100644 --- a/src/input/Makefile.pamphlet +++ b/src/input/Makefile.pamphlet @@ -289,7 +289,7 @@ REGRES= algaggr.regress algbrbf.regress algfacob.regress alist.regress \ bug100.regress bug101.regress \ bug103.regress bug10069.regress \ bugs.regress bug10312.regress bug6357.regress bug9057.regress \ - calcprob.regress \ + cachedf.regress calcprob.regress \ calculus2.regress calculus.regress cardinal.regress card.regress \ carten.regress cclass.regress char.regress ch.regress \ chtheorem.regress classtalk.regress \ @@ -552,7 +552,7 @@ FILES= ${OUT}/algaggr.input ${OUT}/algbrbf.input ${OUT}/algfacob.input \ ${OUT}/bstree.input ${OUT}/bug6357.input \ ${OUT}/bug9057.input ${OUT}/bug100.input ${OUT}/bug101.input \ ${OUT}/bug103.input \ - ${OUT}/bug10069.input ${OUT}/bug10312.input \ + ${OUT}/bug10069.input ${OUT}/bug10312.input ${OUT}/cachedf.input \ ${OUT}/calcprob.input ${OUT}/calculus.input \ ${OUT}/cardinal.input ${OUT}/card.input ${OUT}/carten.input \ ${OUT}/cclass.input ${OUT}/cdraw.input ${OUT}/char.input \ @@ -783,8 +783,8 @@ DOCFILES= \ ${DOC}/c06fqf.input.dvi ${DOC}/c06frf.input.dvi \ ${DOC}/c06fuf.input.dvi ${DOC}/c06gbf.input.dvi \ ${DOC}/c06gcf.input.dvi ${DOC}/c06gqf.input.dvi \ - ${DOC}/c06gsf.input.dvi ${DOC}/calcprob.input.dvi \ - ${DOC}/calculus2.input.dvi \ + ${DOC}/c06gsf.input.dvi ${DOC}/cachedf.input.dvi \ + ${DOC}/calcprob.input.dvi ${DOC}/calculus2.input.dvi \ ${DOC}/calculus.input.dvi ${DOC}/cardinal.input.dvi \ ${DOC}/card.input.dvi ${DOC}/carten.input.dvi \ ${DOC}/cclass.input.dvi ${DOC}/cdraw.input.dvi \ diff --git a/src/input/cachedf.input.pamphlet b/src/input/cachedf.input.pamphlet new file mode 100644 index 0000000..ab950e2 --- /dev/null +++ b/src/input/cachedf.input.pamphlet @@ -0,0 +1,181 @@ +\documentclass{article} +\usepackage{axiom} +\begin{document} +\title{\$SPAD/src/input cachedf.input} +\author{Ralf Hemmecke} +\maketitle +\begin{abstract} +\end{abstract} +\eject +\tableofcontents +\eject +\begin{chunk}{cachedf.spad} +)abbrev domain CACHEDF CachedFunction +++ Author: Ralf Hemmecke +++ Date Created: 2009 +++ Date Last Updated: Oct 27, 2009 +++ Related Domains: Table, AssociationList +++ Description: +++ This domain is a domain of functions with associated cache +CachedFunction(A: SetCategory, B:SetCategory): Exports == Implementation where + Exports ==> with + function: % -> (A -> B) + cachedFunction: (A -> B) -> % + apply: (%,A) -> B + recursiveDefine: (%,f:A -> B) -> % + Implementation ==> add + Rep := Record(cache: Table(A,B), fun: A -> B) + + function(x:%):(A->B) == x.fun + + cachedFunction(f:A->B):% == [empty()$Table(A,B),f] + + apply(x:%,a:A):B == + c := x.cache + u: Union(B,"failed") := search(a,c) + if u case B + then u::B + else + f:A->B := x.fun + c.a := f(a) + + recursiveDefine(x:%,f:A->B):% == + x.fun := f + x +\end{chunk} +\begin{chunk}{*} +)set break resume +)sys rm -f cachedf.output +)spool cachedf.output +)set message test on +)set message auto off +)clear all +)sys cp $AXIOM/../../src/input/cachedf.input.pamphlet . +)lisp (tangle "cachedf.input.pamphlet" "cachedf.spad" "cachedf.spad") +)set message time on + +--S 1 of 8 +)co cachedf +--R +--R Compiling AXIOM source code from file +--I /research/test/int/input/cachedf.spad using old system compiler. +--R CACHEDF abbreviates domain CachedFunction +--R processing macro definition Exports ==> -- the constructor category +--R processing macro definition Implementation ==> -- the constructor capsule +--R------------------------------------------------------------------------ +--R initializing nrlib CACHEDF for CachedFunction +--R compiling into nrlib CACHEDF +--R compiling exported function : $ -> A -> B +--R CACHEDF;function;$M;1 is replaced by QCDR +--ITime: 0.01 SEC. +--R +--R compiling exported cachedFunction : A -> B -> $ +--ITime: 0.01 SEC. +--R +--R compiling exported apply : ($,A) -> B +--ITime: 0 SEC. +--R +--R compiling exported recursiveDefine : ($,A -> B) -> $ +--ITime: 0 SEC. +--R +--R(time taken in buildFunctor: 0 . NIL) +--R +--R;;; *** |CachedFunction| REDEFINED +--R +--R;;; *** |CachedFunction| REDEFINED +--ITime: 0 SEC. +--R +--R +--R Cumulative Statistics for Constructor CachedFunction +--I Time: 0.02 seconds +--R +--R finalizing nrlib CACHEDF +--R Processing CachedFunction for Browser database: +--R--->-->CachedFunction((function ((Mapping B A) %))): Not documented!!!! +--R--->-->CachedFunction((cachedFunction (% (Mapping B A)))): Not documented!!!! +--R--->-->CachedFunction((apply (B % A))): Not documented!!!! +--R--->-->CachedFunction((recursiveDefine (% % (Mapping B A)))): Not documented!!!! +--R--------constructor--------- +--R------------------------------------------------------------------------ +--I CachedFunction is now explicitly exposed in frame frame0 +--R CachedFunction will be automatically loaded when needed from +--I /research/test/int/input/CACHEDF.nrlib/code +--R +--E 1 + +--S 2 of 8 +I := Integer +--R +--R +--R (1) Integer +--R Type: Domain +--I Time: 0 sec +--E 2 + +--S 3 of 8 +f(n:I):I == 1 +--R +--R Function declaration f : Integer -> Integer has been added to +--R workspace. +--R Type: Void +--I Time: 0 sec +--E 3 + +--S 4 of 8 +fib: CachedFunction(I,I) := cachedFunction(f) +--R +--R Compiling function f with type Integer -> Integer +--R +--R LISP output: +--I(# *1;f;1;frame0) +--R Type: CachedFunction(Integer,Integer) +--I Time: 0 sec +--E 4 + +--S 5 of 8 +recursiveDefine(fib,(n:I):I +-> if n<2 then 1 else fib(n-1)+fib(n-2)) +--R +--R +--R LISP output: +--I(# (LAMBDA-CLOSURE (G2554 envArg) (COND ((SPADCALL G2554 2 (ELT *1;anonymousFunction;0;frame0;internal;MV 0)) 1) ((QUOTE T) (SPADCALL (SPADCALL (getValueFromEnvironment (QUOTE fib) (QUOTE (CachedFunction (Integer) (Integer)))) (SPADCALL G2554 1 (ELT *1;anonymousFunction;0;frame0;internal;MV 1)) (ELT *1;anonymousFunction;0;frame0;internal;MV 2)) (SPADCALL (getValueFromEnvironment (QUOTE fib) (QUOTE (CachedFunction (Integer) (Integer)))) (SPADCALL G2554 2 (ELT *1;anonymousFunction;0;frame0;internal;MV 1)) (ELT *1;anonymousFunction;0;frame0;internal;MV 2)) (ELT *1;anonymousFunction;0;frame0;internal;MV 3)))))) +--R Type: CachedFunction(Integer,Integer) +--I Time: 0.02 (IN) + 0.01 (GC) = 0.03 sec +--E 5 + +--S 6 of 8 +fib 40 +--R +--R +--R (5) 165580141 +--R Type: PositiveInteger +--I Time: 0.01 (IN) = 0.01 sec +--E 6 + +--S 7 of 8 +g(n:I):I == if n<2 then 1 else g(n-1)+g(n-2) +--R +--R Function declaration g : Integer -> Integer has been added to +--R workspace. +--R Type: Void +--I Time: 0 sec +--E 7 + +--S 8 of 8 +g 40 +--R +--R Compiling function g with type Integer -> Integer +--R +--R (7) 165580141 +--R Type: PositiveInteger +--I Time: 36.42 (EV) + 0.02 (GC) = 36.44 sec +--E 8 +)spool +)lisp (bye) + +\end{chunk} +\eject +\begin{thebibliography}{99} +\bibitem{1} nothing +\end{thebibliography} +\end{document} +