]> git.donarmstrong.com Git - lilypond.git/blobdiff - guile18/ice-9/debugging/example-fns.scm
Import guile-1.8 as multiple upstream tarball component
[lilypond.git] / guile18 / ice-9 / debugging / example-fns.scm
diff --git a/guile18/ice-9/debugging/example-fns.scm b/guile18/ice-9/debugging/example-fns.scm
new file mode 100644 (file)
index 0000000..30d412f
--- /dev/null
@@ -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)