7126668934
This commit introduces a new prelude file that defines the `while` macro and registers it during environment bootstrapping. The `again` macro has been updated to accept multiple arguments for its recursive call, and several examples have been adjusted to reflect this change. Additionally, the `MacroRegistry` in the compiler is now cloneable and can be moved out of the `MacroExpander`.
11 lines
184 B
Plaintext
11 lines
184 B
Plaintext
;; Benchmark: 2.5us
|
|
;; Benchmark-Repeat: 804
|
|
;; Output: 120
|
|
(do
|
|
(def factorial (fn [n acc]
|
|
(if (= n 0)
|
|
acc
|
|
(again (- n 1) (* acc n)))))
|
|
|
|
(factorial 5 1))
|