]> gitweb.factorcode.org Git - factor.git/blobdiff - basis/math/combinatorics/combinatorics-docs.factor
factor: trim using lists
[factor.git] / basis / math / combinatorics / combinatorics-docs.factor
index 9232d56b21227b94374f92f44ba5178f0946ea66..784f67c94a7c0d002fb50bbdf7c4e2df0602dff9 100644 (file)
@@ -1,4 +1,5 @@
-USING: help.markup help.syntax kernel math math.order sequences ;
+USING: help.markup help.syntax math math.combinatorics
+math.combinatorics.private math.order sequences ;
 IN: math.combinatorics
 
 HELP: factorial
@@ -101,8 +102,6 @@ HELP: each-combination
 { $values { "seq" sequence } { "k" "a non-negative integer" } { "quot" { $quotation ( ... elt -- ... ) } } }
 { $description "Applies the quotation to each combination of " { $snippet "seq" } " choosing " { $snippet "k" } " elements, in order." } ;
 
-
-<PRIVATE
 HELP: factoradic
 { $values { "n" integer } { "factoradic" sequence } }
 { $description "Converts a positive integer " { $snippet "n" } " to factoradic form. The factoradic of an integer is its representation based on a mixed radix numerical system that corresponds to the values of " { $snippet "n" } " factorial." }
@@ -120,6 +119,19 @@ HELP: next-permutation
 { $notes "Performs an in-place modification of " { $snippet "seq" } "." }
 { $examples { $example "USING: math.combinatorics prettyprint ;" "\"ABC\" next-permutation ." "\"ACB\"" } } ;
 
+HELP: all-unique-permutations
+{ $values { "seq" sequence } { "seq'" sequence } }
+{ $description "Outputs a sequence containing all " { $strong "unique" } " permutations of " { $snippet "seq" } " in lexicographical order." }
+{ $examples
+    { $example "USING: math.combinatorics prettyprint ;"
+        "{ 1 1 2 } all-unique-permutations ."
+        "{ { 1 1 2 } { 1 2 1 } { 2 1 1 } }" }
+} ;
+
+HELP: each-unique-permutation
+{ $values { "seq" sequence } { "quot" { $quotation ( ... elt -- ... ) } } }
+{ $description "Applies the quotation to each " { $strong "unique" } " permutation of " { $snippet "seq" } " in order." } ;
+
 HELP: all-subsets
 { $values { "seq" sequence } { "subsets" sequence } }
 { $description
@@ -146,4 +158,3 @@ HELP: all-selections
         "{ { 1 1 } { 1 2 } { 2 1 } { 2 2 } }"
     }
 } ;
-PRIVATE>