home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Jason Aller Floppy Collection
/
168.img
/
ACAD3.ZIP
/
FACT.LSP
< prev
next >
Wrap
Lisp/Scheme
|
1988-05-25
|
364b
|
15 lines
; This is a programming example of a recursive function
; which calculates the factorial of an integer.
(defun factor (y)
(cond ((= 0 y) 1)
(t (* y (factor (1- y))))
)
)
(defun C:FACT (/ x)
(initget 7) ;x must not be null, negative or zero
(setq x (getint "Enter an integer: "))
(factor (float x))
)