math.combinatorics: factorial could be memoized...

db4
John Benediktsson 2012-09-05 11:02:38 -07:00
parent e36c76cadf
commit c86b2d2161
1 changed files with 3 additions and 3 deletions

View File

@ -2,8 +2,8 @@
! See http://factorcode.org/license.txt for BSD license.
USING: accessors arrays assocs binary-search classes.tuple fry
kernel locals math math.order math.ranges namespaces sequences
sequences.private sorting ;
kernel locals math math.order math.ranges memoize namespaces
sequences sequences.private sorting ;
FROM: sequences => change-nth ;
IN: math.combinatorics
@ -17,7 +17,7 @@ IN: math.combinatorics
PRIVATE>
: factorial ( n -- n! )
MEMO: factorial ( n -- n! )
dup 1 > [ [1,b] product ] [ drop 1 ] if ;
: nPk ( n k -- nPk )