summaryrefslogtreecommitdiff
path: root/module/ice-9/debugging/example-fns.scm
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2008-11-01 12:44:21 +0100
committerAndy Wingo <wingo@pobox.com>2008-11-01 12:44:21 +0100
commit00d04892052f345a844c967adbe77c258896c1e7 (patch)
tree6e99b35f9d7d6ac1fe7b452bcad96cfb20f055b8 /module/ice-9/debugging/example-fns.scm
parent5192c9e89bc18e5f6b33741aceed66bf28d56823 (diff)
downloadguile-00d04892052f345a844c967adbe77c258896c1e7.tar.gz
move ice-9/ and oop/ under module/
Moved ice-9/ and oop/ under module/, with the idea being that we have only scheme under module/. Adjusted configure.in and Makefile.am appropriately. Put oop/ at the end of the compilation order.
Diffstat (limited to 'module/ice-9/debugging/example-fns.scm')
-rw-r--r--module/ice-9/debugging/example-fns.scm17
1 files changed, 17 insertions, 0 deletions
diff --git a/module/ice-9/debugging/example-fns.scm b/module/ice-9/debugging/example-fns.scm
new file mode 100644
index 000000000..30d412f00
--- /dev/null
+++ b/module/ice-9/debugging/example-fns.scm
@@ -0,0 +1,17 @@
+(define-module (ice-9 debugging example-fns)
+ #:export (fact1 fact2 facti))
+
+(define (fact1 n)
+ (if (= n 0)
+ 1
+ (* n (fact1 (- n 1)))))
+
+(define (facti n a)
+ (if (= n 0)
+ a
+ (facti (- n 1) (* a n))))
+
+(define (fact2 n)
+ (facti n 1))
+
+; Test: (fact2 3)