Examples#
Examples are run using interpreter build for POSIX platform. Before executing examples, interpreter is bootstrapped with base-large.lsp extensions.
Factorial#
Simple implementation of factorials calculation.
(define (factorial x)
(if x
(* x (factorial (- x 1)))
1))
(factorial 10)
Example execution:
$ cat src_lsp/base-large.lsp examples/factorial.lsp | build/posix/lisp16
3628800