From 2b73f2c90d9a2cc3e2b09dfd12ddb9b3a6d8e67d Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Sun, 31 Jul 2022 12:18:41 -0500 Subject: [PATCH] core: update docs for new words --- core/math/math-docs.factor | 5 +++++ core/sequences/sequences-docs.factor | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/core/math/math-docs.factor b/core/math/math-docs.factor index 82f44375fb..1fdc0b01c6 100644 --- a/core/math/math-docs.factor +++ b/core/math/math-docs.factor @@ -449,6 +449,11 @@ HELP: all-integers? { $description "Applies the quotation to each integer from 0 up to " { $snippet "n" } ", excluding " { $snippet "n" } ". Iteration stops when the quotation outputs " { $link f } " or the end is reached. If the quotation yields a false value for some integer, this word outputs " { $link f } ". Otherwise, this word outputs " { $link t } "." } { $notes "This word is used to implement " { $link all? } "." } ; +HELP: find-integer-from +{ $values { "i" integer } { "n" integer } { "quot" { $quotation ( ... i -- ... ? ) } } { "i/f" { $maybe integer } } } +{ $description "Applies the quotation to each integer from " { $snippet "i" } " up to " { $snippet "n" } ", excluding " { $snippet "n" } ". Iteration stops when the quotation outputs a true value or the end is reached. If the quotation yields a true value for some integer, this word outputs that integer. Otherwise, this word outputs " { $link f } "." } +{ $notes "This word is used to implement " { $link find-integer } " and " { $link find } "." } ; + HELP: find-integer { $values { "n" integer } { "quot" { $quotation ( ... i -- ... ? ) } } { "i/f" { $maybe integer } } } { $description "Applies the quotation to each integer from 0 up to " { $snippet "n" } ", excluding " { $snippet "n" } ". Iteration stops when the quotation outputs a true value or the end is reached. If the quotation yields a true value for some integer, this word outputs that integer. Otherwise, this word outputs " { $link f } "." } diff --git a/core/sequences/sequences-docs.factor b/core/sequences/sequences-docs.factor index 3d7767b3ee..6858135aa3 100644 --- a/core/sequences/sequences-docs.factor +++ b/core/sequences/sequences-docs.factor @@ -1210,6 +1210,10 @@ HELP: subseq? { $values { "subseq" sequence } { "seq" sequence } { "?" boolean } } { $description "Tests if " { $snippet "seq" } " contains the elements of " { $snippet "subseq" } " as a contiguous subsequence." } ; +HELP: subseq-index? +{ $values { "seq" sequence } { "subseq" sequence } { "?" boolean } } +{ $description "Tests if " { $snippet "seq" } " contains the elements of " { $snippet "subseq" } " as a contiguous subsequence." } ; + HELP: drop-prefix { $values { "seq1" sequence } { "seq2" sequence } { "slice1" "a slice" } { "slice2" "a slice" } } { $description "Outputs a pair of virtual sequences with the common prefix of " { $snippet "seq1" } " and " { $snippet "seq2" } " removed." } ; @@ -1934,7 +1938,7 @@ ARTICLE: "sequences-tests" "Testing sequences" "Testing if a sequence contains an object:" { $subsections member? member-eq? } "Testing if a sequence contains a subsequence:" -{ $subsections head? tail? subseq? } ; +{ $subsections head? tail? subseq? subseq-index? } ; ARTICLE: "sequences-search" "Searching sequences" "Finding the index of an element:" -- 2.34.1