git » jacl.git » commit d7cf8fd

update fact func in notes

author Alan Dipert
2019-12-28 07:00:14 UTC
committer Alan Dipert
2019-12-28 07:00:14 UTC
parent 03671580d7a4ab67273498645fa118b509d1b015

update fact func in notes

notes.txt +11 -9

diff --git a/notes.txt b/notes.txt
index 16f2f1a..c33e7c8 100644
--- a/notes.txt
+++ b/notes.txt
@@ -44,15 +44,17 @@ window
  (to-js "hello, world!"))
 
 ;; factorial
-(%lambda (n &aux (prod 1))
-  (%tagbody
-    t0
-    (%if (!eql n 0) (%go done) nil)
-    (%set prod (!* prod n))
-    (%set n (!- n 1))
-    (%go t0)
-    done)
-  prod)
+(%js "(~{}.fvalue = ~{})"
+  'fact
+  (%lambda (n &aux (prod 1))
+    (%tagbody
+      t0
+      (%if (!eql n 0) (%go done) nil)
+      (%set prod (!* prod n))
+      (%set n (!- n 1))
+      (%go t0)
+      done)
+    prod))
 
 (%let ((x 0))
   (%tagbody