1
5
mirror of https://github.com/vinc/moros.git synced 2024-06-15 05:36:38 +00:00
moros/dsk/tmp/lisp/sum.lsp
Vincent Ollivier ab9b488a49
Update lisp doc and examples (#428)
* 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
2022-11-01 11:02:50 +01:00

9 lines
182 B
Plaintext

(load "/lib/lisp/core.lsp")
(define (sum n acc)
(if (= n 0) acc (sum (- n 1) (+ n acc))))
(println
(if (nil? args) "Usage: sum <num>"
(sum (string->number (car args)) 0)))