]> gitweb.factorcode.org Git - factor.git/commitdiff
binary-search-docs: supplement the search description
authorAlexander Iljin <ajsoft@yandex.ru>
Tue, 10 Jan 2017 20:36:22 +0000 (23:36 +0300)
committerAlexander Iljin <ajsoft@yandex.ru>
Fri, 13 Jan 2017 10:31:34 +0000 (13:31 +0300)
basis/binary-search/binary-search-docs.factor

index 47696af7d637133234f7f4a7ca0a038e4a9bf6ca..314c0b8d5e98e20e121f06a8f918a88ff26eb1ad 100644 (file)
@@ -5,7 +5,7 @@ HELP: search
 { $values { "seq" "a sorted sequence" } { "quot" { $quotation ( elt -- <=> ) } } { "i" "an index, or " { $link f } } { "elt" "an element, or " { $link f } } }
 { $description "Performs a binary search on a sequence, calling the quotation to decide whether to end the search (" { $link +eq+ } "), search lower (" { $link +lt+ } ") or search higher (" { $link +gt+ } ")."
 $nl
-"If the sequence is non-empty, outputs the index and value of the closest match, which is either an element for which the quotation output " { $link +eq+ } ", or failing that, least element for which the quotation output " { $link +lt+ } "."
+"If the sequence is non-empty, outputs the index and value of the closest match, which is either an element for which the quotation output " { $link +eq+ } ", or failing that, the least element for which the quotation output " { $link +lt+ } ", or if there were none of the above, the greatest element for which the quotation output " { $link +gt+ } "."
 $nl
 "If the sequence is empty, outputs " { $link f } " " { $link f } "." }
 { $notes "If the sequence has at least one element, this word always outputs a valid index, because it finds the closest match, not necessarily an exact one. In this respect its behavior differs from " { $link find } "." }