aboutsummaryrefslogtreecommitdiff
path: root/examples/factorial.lsp
diff options
context:
space:
mode:
authorbozo.kopic <bozo@kopic.xyz>2022-08-02 01:20:12 +0200
committerbozo.kopic <bozo@kopic.xyz>2022-09-25 02:40:23 +0200
commit288727f09a1b3458c268497d111349e608c3f9fa (patch)
treed62565249fa3c7127856c65405752572fc41aca9 /examples/factorial.lsp
Diffstat (limited to 'examples/factorial.lsp')
-rw-r--r--examples/factorial.lsp6
1 files changed, 6 insertions, 0 deletions
diff --git a/examples/factorial.lsp b/examples/factorial.lsp
new file mode 100644
index 0000000..a539a01
--- /dev/null
+++ b/examples/factorial.lsp
@@ -0,0 +1,6 @@
+(define (factorial x)
+ (if x
+ (* x (factorial (- x 1)))
+ 1))
+
+(factorial 10)