ref: ad50f75a7c9276fa04a0e91c54be24d2cec74b28
dir: /test/perf.lsp/
(load "test.lsp")
(def Y
(λ (f)
((λ (h)
(f (λ (x) ((h h) x))))
(λ (h)
(f (λ (x) ((h h) x)))))))
(def yfib
(Y (λ (fib)
(λ (n)
(if (< n 2) n (+ (fib (- n 1)) (fib (- n 2))))))))
(def (fib n) (if (< n 2) n (+ (fib (- n 1)) (fib (- n 2)))))
(princ "colorgraph: ")
(load "tcolor.lsp")
(princ "fib(34): ")
(assert (equal? (time (fib 34)) 5702887))
(princ "yfib(32): ")
(assert (equal? (time (yfib 32)) 2178309))
(princ "sort: ")
(set! r (map-int (λ (x) (mod (+ (* x 9421) 12345) 1024)) 1000))
(time (simple-sort r))
(princ "macroexpand: ")
(time (dotimes (n 5000) (macroexpand '(dotimes (i 100) body1 body2))))
(def (my-append . lsts)
(cond ((not lsts) nil)
((not (cdr lsts)) (car lsts))
(else (letrec ((append2 (λ (l d)
(if (not l)
d
(cons (car l)
(append2 (cdr l) d))))))
(append2 (car lsts) (apply my-append (cdr lsts)))))))
(princ "append: ")
(set! L (map-int (λ (x) (map-int identity 20)) 20))
(time (dotimes (n 1000) (apply my-append L)))
(path-cwd "ast")
(princ "p-lambda: ")
(load "rpasses.lsp")
(def *input* (load "datetimeR.lsp"))
(time (set! *output* (compile-ish *input*)))
(assert (equal? *output* (load "rpasses-out.lsp")))
(path-cwd "..")