Files
RustAst/examples/tak.myc
T
2026-02-19 17:12:37 +01:00

18 lines
453 B
Plaintext

;; Benchmark: 602.1us
;; Takeuchi Function Benchmark
;; Benchmark: ~150ms (Specialized) vs ~1.5s (Dynamic)
;; heavily recursive, benefits significantly from specialization of integer arithmetic
;; and direct function calls (skipping dynamic dispatch).
;; Output: 7
(do
(def tak (fn [x y z]
(if (<= x y)
y
(tak (tak (- x 1) y z)
(tak (- y 1) z x)
(tak (- z 1) x y)))))
(tak 10 6 3)
)