From 31a9954530c424e7dfb22a7da1cd80d5df5a7f8a Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Mon, 14 Apr 2008 05:19:26 -0500 Subject: [PATCH] Documentation updates and cleanups --- core/assocs/assocs-docs.factor | 9 +++++++-- core/sequences/sequences-docs.factor | 7 +------ core/sets/authors.txt | 2 ++ core/sets/sets-docs.factor | 7 +++++-- core/sets/summary.txt | 1 + core/sets/tags.txt | 1 + core/threads/threads.factor | 9 ++++++--- extra/arrays/lib/summary.txt | 1 + extra/concurrency/mailboxes/mailboxes.factor | 14 +++++--------- extra/help/handbook/handbook.factor | 3 ++- extra/sequences/lib/summary.txt | 1 + extra/sequences/next/summary.txt | 1 + extra/trees/splay/summary.txt | 2 +- 13 files changed, 34 insertions(+), 24 deletions(-) create mode 100644 core/sets/authors.txt create mode 100644 core/sets/summary.txt create mode 100644 core/sets/tags.txt create mode 100644 extra/arrays/lib/summary.txt create mode 100644 extra/sequences/lib/summary.txt create mode 100644 extra/sequences/next/summary.txt diff --git a/core/assocs/assocs-docs.factor b/core/assocs/assocs-docs.factor index 687e60621e..863fdaecb3 100755 --- a/core/assocs/assocs-docs.factor +++ b/core/assocs/assocs-docs.factor @@ -76,7 +76,7 @@ ARTICLE: "assocs-sets" "Set-theoretic operations on assocs" { $subsection remove-all } { $subsection substitute } { $subsection substitute-here } -{ $see-also key? } ; +{ $see-also key? assoc-contains? assoc-all? "sets" } ; ARTICLE: "assocs-mutation" "Storing keys and values in assocs" "Utility operations built up from the " { $link "assocs-protocol" } ":" @@ -97,6 +97,7 @@ $nl { $subsection assoc-map } { $subsection assoc-push-if } { $subsection assoc-subset } +{ $subsection assoc-contains? } { $subsection assoc-all? } "Three additional combinators:" { $subsection cache } @@ -206,9 +207,13 @@ HELP: assoc-subset { $values { "assoc" assoc } { "quot" "a quotation with stack effect " { $snippet "( key value -- ? )" } } { "subassoc" "a new assoc" } } { $description "Outputs an assoc of the same type as " { $snippet "assoc" } " consisting of all entries for which the predicate quotation yields true." } ; +HELP: assoc-contains? +{ $values { "assoc" assoc } { "quot" "a quotation with stack effect " { $snippet "( key value -- ? )" } } { "?" "a boolean" } } +{ $description "Tests if the assoc contains an entry satisfying a predicate by applying the quotation to each entry in turn. Iteration stops if an entry is found for which the quotation outputs a true value." } ; + HELP: assoc-all? { $values { "assoc" assoc } { "quot" "a quotation with stack effect " { $snippet "( key value -- ? )" } } { "?" "a boolean" } } -{ $description "Applies a predicate quotation to entry in the assoc. Outputs true if the assoc yields true for each entry (which includes the case where the assoc is empty)." } ; +{ $description "Tests if all entries in the assoc satisfy a predicate by applying the quotation to each entry in turn. a predicate quotation to entry in the assoc. Iteration stops if an entry is found for which the quotation outputs " { $link f } ". If the assoc is empty, always outputs " { $link t } "." } ; HELP: subassoc? { $values { "assoc1" assoc } { "assoc2" assoc } { "?" "a new assoc" } } diff --git a/core/sequences/sequences-docs.factor b/core/sequences/sequences-docs.factor index a4696a76ae..bb3dc9337e 100755 --- a/core/sequences/sequences-docs.factor +++ b/core/sequences/sequences-docs.factor @@ -528,12 +528,7 @@ HELP: contains? HELP: all? { $values { "seq" sequence } { "quot" "a quotation with stack effect " { $snippet "( elt -- ? )" } } { "?" "a boolean" } } -{ $description "Tests if all elements in the sequence satisfy the predicate by checking each element in turn. Given an empty sequence, vacuously outputs " { $link t } "." } -{ $notes - "The implementation makes use of a well-known logical identity:" - $nl - { $snippet "P[x] for all x <==> not ((not P[x]) for some x)" } -} ; +{ $description "Tests if all elements in the sequence satisfy the predicate by checking each element in turn. Given an empty sequence, vacuously outputs " { $link t } "." } ; HELP: push-if { $values { "elt" object } { "quot" "a quotation with stack effect " { $snippet "( elt -- ? )" } } { "accum" "a resizable mutable sequence" } } diff --git a/core/sets/authors.txt b/core/sets/authors.txt new file mode 100644 index 0000000000..f372b574ae --- /dev/null +++ b/core/sets/authors.txt @@ -0,0 +1,2 @@ +Slava Pestov +Doug Coleman diff --git a/core/sets/sets-docs.factor b/core/sets/sets-docs.factor index 01b8b8efd7..8217bb514b 100644 --- a/core/sets/sets-docs.factor +++ b/core/sets/sets-docs.factor @@ -1,7 +1,9 @@ USING: kernel help.markup help.syntax sequences ; IN: sets -ARTICLE: "sets" "Set theoretic operations" +ARTICLE: "sets" "Set-theoretic operations on sequences" +"Set-theoretic operations on sequences are defined on the " { $vocab-link "sets" } " vocabulary. These operations use hashtables internally to achieve linear running time." +$nl "Remove duplicates:" { $subsection prune } "Test for duplicates:" @@ -9,7 +11,8 @@ ARTICLE: "sets" "Set theoretic operations" "Set operations on sequences:" { $subsection diff } { $subsection intersect } -{ $subsection union } ; +{ $subsection union } +{ $see-also member? memq? contains? all? "assocs-sets" } ; HELP: unique { $values { "seq" "a sequence" } { "assoc" "an assoc" } } diff --git a/core/sets/summary.txt b/core/sets/summary.txt new file mode 100644 index 0000000000..f987cc27ad --- /dev/null +++ b/core/sets/summary.txt @@ -0,0 +1 @@ +Set-theoretic operations on sequences diff --git a/core/sets/tags.txt b/core/sets/tags.txt new file mode 100644 index 0000000000..42d711b32b --- /dev/null +++ b/core/sets/tags.txt @@ -0,0 +1 @@ +collections diff --git a/core/threads/threads.factor b/core/threads/threads.factor index e15ebdf532..f99191b91f 100755 --- a/core/threads/threads.factor +++ b/core/threads/threads.factor @@ -56,13 +56,16 @@ mailbox variables sleep-entry ; PRIVATE> -: ( quot name -- thread ) - \ thread new +: new-thread ( quot name class -- thread ) + new swap >>name swap >>quot \ thread counter >>id >>continuation - [ ] >>exit-handler ; + [ ] >>exit-handler ; inline + +: ( quot name -- thread ) + \ thread new-thread ; : run-queue 42 getenv ; diff --git a/extra/arrays/lib/summary.txt b/extra/arrays/lib/summary.txt new file mode 100644 index 0000000000..5ecd994103 --- /dev/null +++ b/extra/arrays/lib/summary.txt @@ -0,0 +1 @@ +Non-core array words diff --git a/extra/concurrency/mailboxes/mailboxes.factor b/extra/concurrency/mailboxes/mailboxes.factor index 1507a36254..ac03197708 100755 --- a/extra/concurrency/mailboxes/mailboxes.factor +++ b/extra/concurrency/mailboxes/mailboxes.factor @@ -81,23 +81,19 @@ M: mailbox dispose : wait-for-close ( mailbox -- ) f wait-for-close-timeout ; -TUPLE: linked-error thread ; +TUPLE: linked-error error thread ; -: ( error thread -- linked ) - { set-delegate set-linked-error-thread } - linked-error construct ; +C: linked-error : ?linked dup linked-error? [ rethrow ] when ; -TUPLE: linked-thread supervisor ; +TUPLE: linked-thread < thread supervisor ; M: linked-thread error-in-thread - [ ] keep - linked-thread-supervisor mailbox-put ; + [ ] [ supervisor>> ] bi mailbox-put ; : ( quot name mailbox -- thread' ) - >r linked-thread construct-delegate r> - over set-linked-thread-supervisor ; + >r linked-thread new-thread r> >>supervisor ; : spawn-linked-to ( quot name mailbox -- thread ) [ (spawn) ] keep ; diff --git a/extra/help/handbook/handbook.factor b/extra/help/handbook/handbook.factor index acdbca82ee..4e6bfe4888 100755 --- a/extra/help/handbook/handbook.factor +++ b/extra/help/handbook/handbook.factor @@ -3,7 +3,7 @@ namespaces words sequences classes assocs vocabs kernel arrays prettyprint.backend kernel.private io generic math system strings sbufs vectors byte-arrays bit-arrays float-arrays quotations io.streams.byte-array io.encodings.string -classes.builtin ; +classes.builtin parser ; IN: help.handbook ARTICLE: "conventions" "Conventions" @@ -25,6 +25,7 @@ $nl { { $snippet { $emphasis "foo" } "?" } "outputs a boolean" { { $link empty? } } } { { $snippet "?" { $emphasis "foo" } } { "conditionally performs " { $snippet { $emphasis "foo" } } } { { $links ?nth } } } { { $snippet "<" { $emphasis "foo" } ">" } { "creates a new " { $snippet "foo" } } { { $link } } } + { { $snippet "new-" { $emphasis "foo" } } { "creates a new " { $snippet "foo" } ", taking some kind of parameter from the stack which determines the type of the object to be created" } { { $link new-sequence } ", " { $link new-lexer } ", " { $link new } } } { { $snippet { $emphasis "foo" } "*" } { "alternative form of " { $snippet "foo" } ", or a generic word called by " { $snippet "foo" } } { { $links at* pprint* } } } { { $snippet "(" { $emphasis "foo" } ")" } { "implementation detail word used by " { $snippet "foo" } } { { $link (clone) } } } { { $snippet "set-" { $emphasis "foo" } } { "sets " { $snippet "foo" } " to a new value" } { $links set-length } } diff --git a/extra/sequences/lib/summary.txt b/extra/sequences/lib/summary.txt new file mode 100644 index 0000000000..e389b415ca --- /dev/null +++ b/extra/sequences/lib/summary.txt @@ -0,0 +1 @@ +Non-core sequence words diff --git a/extra/sequences/next/summary.txt b/extra/sequences/next/summary.txt new file mode 100644 index 0000000000..fe5bd315de --- /dev/null +++ b/extra/sequences/next/summary.txt @@ -0,0 +1 @@ +Iteration with access to next element diff --git a/extra/trees/splay/summary.txt b/extra/trees/splay/summary.txt index e70c874e98..46391bbd28 100644 --- a/extra/trees/splay/summary.txt +++ b/extra/trees/splay/summary.txt @@ -1 +1 @@ -Splay Trees +Splay trees