RosettaCodeData/Task/Factorial/CLIPS/factorial.clips
2023-07-01 13:44:08 -04:00

8 lines
228 B
Text

(deffunction factorial (?a)
(if (or (not (integerp ?a)) (< ?a 0)) then
(printout t "Factorial Error!" crlf)
else
(if (= ?a 0) then
1
else
(* ?a (factorial (- ?a 1))))))