parent 1634a1ac
......@@ -17,7 +17,7 @@
rec-lam-once rec-lam-0 rec-lam-once-0
gp-cp-rec gp->scm-rec canon-it-rec
with-nonrec-unifyer nonrec-unifyer
recursive rational-canon))
Memoizing can speed up function evaluation by memoizing the input and output.
......@@ -644,10 +644,7 @@ THIS WAS TOO EXPENSIVE
(<lambda> (y)
(<code> (hashq-set! mp (<lookup> y) #t)))
(let* ((y (gp-var! s))
(s (rational-canon s (lambda () #f) (lambda (s . l) s) x y)))
(canon-it++ gp->scm-rec analyze y s)))
(canon-it++ gp->scm-rec analyze x s)))
(make-fluid-dynamics gp-unifier)
......@@ -745,26 +742,4 @@ f(X,L,Y,M)
(<define> (recursive f . x)
(with-rec-unifyer (<lambda> (<apply> f x))))
(<define> (rational-canon x y)
(<let> ((m (make-hash-table))
(f (make-hash-table)))
(<lambda> (x)
(<code> (hashq-set! m x (make-variable #f))))
(<lambda> (x y)
(<let> ((r (hashq-ref m (<lookup> x) #f)))
(when r
(<let> ((rr (hashq-ref f (<lookup> x) #f)))
(if rr
(rec= y r)
(variable-set! r y)
(hashq-set! f (<lookup> x) r))
x y)))
(with-rec-unifyer (<lambda> (<apply> f x))))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment