计算排列数

2019-01-26 / Common Lisp

 

(defun permutation-count (n c)
    (let ((ans 1))
        (loop for i from (- n (1- c)) upto n do (setf ans (* ans i))) ans))


(format t "~D~%" (permutation-count 6 5))