]> gitweb.factorcode.org Git - factor.git/commitdiff
Add more documentation for math.statistics
authorBenjamin Pollack <benjamin@bitquabit.com>
Fri, 30 Jan 2015 13:20:50 +0000 (08:20 -0500)
committerJohn Benediktsson <mrjbq7@gmail.com>
Sat, 31 Jan 2015 01:04:40 +0000 (17:04 -0800)
basis/math/statistics/statistics-docs.factor

index f6e66793e9469b0806e58014f826218340c7e91e..b408acf581c6193a12fac515a2226f1479226b4a 100644 (file)
@@ -15,6 +15,11 @@ HELP: harmonic-mean
 { $examples { $example "USING: math.statistics prettyprint ;" "{ 1 2 3 } harmonic-mean ." "6/11" } }
 { $errors "Throws a " { $link signal-error. } " (divide by zero) if the sequence is empty." } ;
 
+HELP: kth-smallest
+{ $values { "seq" sequence } { "k" integer } }
+{ $description "Returns the kth smallest element.  This is semantically equivalent to " { $snippet "swap natural-sort nth" } ", and is therefore zero-indexed.  " { $snippet "k" } " may not be larger than the highest index of " { $snippet "sequence" } "." }
+{ $examples { $example "USING: math.statistics ;" "{ 3 1 2 } 1 kth-smallest ." "2" } } ;
+
 HELP: mean
 { $values { "seq" sequence } { "x" "a non-negative real number"} }
 { $description "Computes the arithmetic mean of the elements in " { $snippet "seq" } "." }