summaryrefslogtreecommitdiff
path: root/alsalisp
diff options
context:
space:
mode:
authorJaroslav Kysela <perex@perex.cz>2003-07-26 15:19:27 +0000
committerJaroslav Kysela <perex@perex.cz>2003-07-26 15:19:27 +0000
commitb3e3c349cebb5feff59440191e7680e8c777c045 (patch)
tree4840d4f46c83e3decf01abd9cc2d5afdcfdab812 /alsalisp
parentb5c2327ce77a349a268ec590fd81babf43abf092 (diff)
Added float number support
Replaced 'int' with 'long' (integer type) Improved garbage collect
Diffstat (limited to 'alsalisp')
-rw-r--r--alsalisp/hello.lisp7
1 files changed, 5 insertions, 2 deletions
diff --git a/alsalisp/hello.lisp b/alsalisp/hello.lisp
index 6bf0877f..a1118f6b 100644
--- a/alsalisp/hello.lisp
+++ b/alsalisp/hello.lisp
@@ -2,11 +2,14 @@
(princ "One " 1 "\n")
(princ "Two " (+ 1 1) "\n")
-(defun myprinc (o) (princ o))
+(defun myprinc (o) (progn (princ o)))
(myprinc "Printed via myprinc function!\n")
(defun printnum (from to) (while (<= from to) (princ " " from) (setq from (+ from 1))))
(princ "Numbers 1-10: ") (printnum 1 10) (princ "\n")
-(defun factorial (n) (when (> n 0) (* n (factorial (- n 1)))))
+(defun factorial (n) (if (> n 1) (* n (factorial (- n 1))) 1))
(princ "Factorial of 10: " (factorial 10) "\n")
+
+(princ "Float test 1.1 + 1.35 = " (+ 1.1 1.35) "\n")
+(princ "Factorial of 10.0: " (factorial 10.0) "\n")