]> gitweb.factorcode.org Git - factor.git/commitdiff
math.combinatorics: remove memoize of factorial.
authorJohn Benediktsson <mrjbq7@gmail.com>
Tue, 16 Jan 2018 22:57:17 +0000 (14:57 -0800)
committerJohn Benediktsson <mrjbq7@gmail.com>
Tue, 16 Jan 2018 22:57:17 +0000 (14:57 -0800)
If lots of large factorials are computed could use too much memory.

basis/math/combinatorics/combinatorics.factor

index 6c6792ed8961f4ddfa707d3cf69429d0b0c15d70..db2645047e4928c96a58f3a645ccb27cb9948540 100644 (file)
@@ -3,8 +3,8 @@
 
 USING: accessors arrays assocs binary-search classes.tuple
 combinators fry hints kernel kernel.private locals math
-math.order math.ranges memoize namespaces sequences
-sequences.private sorting strings vectors ;
+math.order math.ranges namespaces sequences sequences.private
+sorting strings vectors ;
 IN: math.combinatorics
 
 <PRIVATE
@@ -28,7 +28,7 @@ M: object nths-unsafe (nths-unsafe) ;
 
 PRIVATE>
 
-MEMO: factorial ( n -- n! )
+: factorial ( n -- n! )
     dup 1 > [ [1,b] product ] [ drop 1 ] if ;
 
 : nPk ( n k -- nPk )