Dear Bil,

On 31. Dec 2020, at 15:13, [email protected] <[email protected]> wrote:

I think the problem here is with-let -- it is blocking
the normal optimizations that would otherwise speed
up fib.  Here is an ugly substitute:

(let ((temp-value #f))
   (define *texmacs-module* (curlet))
   (define-macro (tm-define head . body)
     `(eval (list 'define ',head ',@body) *texmacs-module*))

   (let ()
       (tm-define fib (lambda (n) (if (< n 2) n (+ (fib (- n 1)) (fib (- n 2)))))))

   (let ((n 40))
       (format *stdout* "(fib ~A) : ~A \n" n (fib n))))

There has to be a prettier way to do it!

with-let should not be so paranoid...


 thanks, indeed it works for the small example. However the *real thing* still run as slow as before even with this replacement.

I've extracted the "real" tm-define and I attach a test case which indeed still show the slowness even using the "eval" trick.

I hope there is something to do about it. Even a trick would do, this is the only point in all the sources where I do some trickery with lets.

Max

Attachment: fib4.scm
Description: Binary data



_______________________________________________
Cmdist mailing list
[email protected]
https://cm-mail.stanford.edu/mailman/listinfo/cmdist

Reply via email to