;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;; ;;;;;;;; ;;;;;; All files in this directory or any subdirectories are ;;;;;;;; ;;;;;; copyright 1997, 1998, 1999, 2000, 2002. ;;;;;;;; ;;;;;; by Rafael D. Sorkin. All rights reserved. ;;;;;;;; ;;;;;; ;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun ! (n) "Factorial of INTEGER argument" (cond ((not (integerp n)) (error "This one is for integers only")) ((< n 0) Infinity%) ((= 0 n) 1) (t (* n (! (1- n)))))) ; Since `!' is built into some TCL implementations, we don't define it in ; bib.gen.tcl (It seems not to be present in CLtL1, cmucl or gcl, but Clisp ; definitely does have it.) (defun product-m (X) " Multiplies together numbers in a list" (apply (function *) X)) (defalias 'product 'product-m) (defun sum-m (X) "Adds up the numbers in a list" (apply (function +) X)) (defalias 'sum 'sum-m)