From: Alex Klinkhamer Date: Sun, 6 Jul 2008 15:54:28 +0000 (-0400) Subject: +Learned to count X-Git-Url: https://repo.or.cz/w/lineal.git/commitdiff_plain/c7688fd1c0c22204cae89d51a8e8752e85370882 +Learned to count Permutations were implemented wrong. Can also use counting functions from Lineal's webui if you know they exist. --- diff --git a/src/math/counting.lisp b/src/math/counting.lisp index f523c96..93f159f 100644 --- a/src/math/counting.lisp +++ b/src/math/counting.lisp @@ -16,7 +16,7 @@ (defun nPr (n r) (declare (integer n r)) (loop :for k :from (- n r) :to n - :for prod = k :then (* prod k) + :for prod = 1 :then (* prod k) :finally (return prod))) ;V combination V diff --git a/src/overload/client-fns.lisp b/src/overload/client-fns.lisp index cf2569c..9867e18 100644 --- a/src/overload/client-fns.lisp +++ b/src/overload/client-fns.lisp @@ -14,6 +14,7 @@ ("dot" over-dot-prod) ("expt" exptn) ("inverse" over-multv-inverse) + ("nAr" nAr) ("nCr" nCr) ("nPr" nPr) ("orth" over-orth) ("proj" over-proj) ("recall" lineal::over-recall) diff --git a/src/overload/overload.lisp b/src/overload/overload.lisp index 5730c84..46cf928 100644 --- a/src/overload/overload.lisp +++ b/src/overload/overload.lisp @@ -14,6 +14,7 @@ :lineal.math det dot-prod + factorial mtrix-addn mtrix-augment mtrix-coltuple-multn @@ -23,6 +24,7 @@ mtrix-square-identity mtrix-subtrn mtrix-transpose + nAr nCr nPr nullspace output-tuple output-matrix