mirror of
https://github.com/vinc/moros.git
synced 2024-06-18 23:17:04 +00:00
* Update documentation * Add macro? * Rewrite and and or with macros * Move string-join * Update built-in autocompletion * Use define instead of def in core and examples * Add changelog to doc * Move aliases to lib * Add let macro * Add caar cadr cdar cddr functions * Add fixme * Fix let macro
13 lines
271 B
Plaintext
13 lines
271 B
Plaintext
(load "/lib/lisp/core.lsp")
|
|
|
|
(define (factorial-helper n acc)
|
|
(if (< n 2) acc
|
|
(factorial-helper (- n 1) (* acc n))))
|
|
|
|
(define (factorial n)
|
|
(factorial-helper n 1))
|
|
|
|
(println
|
|
(if (nil? args) "Usage: factorial <num>"
|
|
(factorial (string->number (car args)))))
|