math.combinatorics: remove memoize of factorial.
If lots of large factorials are computed could use too much memory.factor-shell
parent
1c41499681
commit
9a4441a80e
|
@ -3,8 +3,8 @@
|
||||||
|
|
||||||
USING: accessors arrays assocs binary-search classes.tuple
|
USING: accessors arrays assocs binary-search classes.tuple
|
||||||
combinators fry hints kernel kernel.private locals math
|
combinators fry hints kernel kernel.private locals math
|
||||||
math.order math.ranges memoize namespaces sequences
|
math.order math.ranges namespaces sequences sequences.private
|
||||||
sequences.private sorting strings vectors ;
|
sorting strings vectors ;
|
||||||
IN: math.combinatorics
|
IN: math.combinatorics
|
||||||
|
|
||||||
<PRIVATE
|
<PRIVATE
|
||||||
|
@ -28,7 +28,7 @@ M: object nths-unsafe (nths-unsafe) ;
|
||||||
|
|
||||||
PRIVATE>
|
PRIVATE>
|
||||||
|
|
||||||
MEMO: factorial ( n -- n! )
|
: factorial ( n -- n! )
|
||||||
dup 1 > [ [1,b] product ] [ drop 1 ] if ;
|
dup 1 > [ [1,b] product ] [ drop 1 ] if ;
|
||||||
|
|
||||||
: nPk ( n k -- nPk )
|
: nPk ( n k -- nPk )
|
||||||
|
|
Loading…
Reference in New Issue