]> gitweb.factorcode.org Git - factor.git/commitdiff
Documentation updates and cleanups
authorSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Mon, 14 Apr 2008 10:19:26 +0000 (05:19 -0500)
committerSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Mon, 14 Apr 2008 10:19:26 +0000 (05:19 -0500)
13 files changed:
core/assocs/assocs-docs.factor
core/sequences/sequences-docs.factor
core/sets/authors.txt [new file with mode: 0644]
core/sets/sets-docs.factor
core/sets/summary.txt [new file with mode: 0644]
core/sets/tags.txt [new file with mode: 0644]
core/threads/threads.factor
extra/arrays/lib/summary.txt [new file with mode: 0644]
extra/concurrency/mailboxes/mailboxes.factor
extra/help/handbook/handbook.factor
extra/sequences/lib/summary.txt [new file with mode: 0644]
extra/sequences/next/summary.txt [new file with mode: 0644]
extra/trees/splay/summary.txt

index 687e60621e98cbbc2a5e9858eaf3c4e169a2e98f..863fdaecb3cbbb56fc6d7a19bb013322bcf6c06b 100755 (executable)
@@ -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" } }
index a4696a76aef0dfc61df32199202df6985a2518bb..bb3dc9337e84317e351273e7e6668c84e0d39d66 100755 (executable)
@@ -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 (file)
index 0000000..f372b57
--- /dev/null
@@ -0,0 +1,2 @@
+Slava Pestov
+Doug Coleman
index 01b8b8efd7a379f5ebcdfdc75a0e8d9621cb8b4e..8217bb514b5054c45cfd032802ec0cdb37221654 100644 (file)
@@ -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 (file)
index 0000000..f987cc2
--- /dev/null
@@ -0,0 +1 @@
+Set-theoretic operations on sequences
diff --git a/core/sets/tags.txt b/core/sets/tags.txt
new file mode 100644 (file)
index 0000000..42d711b
--- /dev/null
@@ -0,0 +1 @@
+collections
index e15ebdf53208334d90bc0ec7c2ce65d594dc0349..f99191b91ffac7b08ceb66150f218ed4cab94b39 100755 (executable)
@@ -56,13 +56,16 @@ mailbox variables sleep-entry ;
 
 PRIVATE>
 
-: <thread> ( quot name -- thread )
-    \ thread new
+: new-thread ( quot name class -- thread )
+    new
         swap >>name
         swap >>quot
         \ thread counter >>id
         <box> >>continuation
-        [ ] >>exit-handler ;
+        [ ] >>exit-handler ; inline
+
+: <thread> ( 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 (file)
index 0000000..5ecd994
--- /dev/null
@@ -0,0 +1 @@
+Non-core array words
index 1507a362547d9bc461fb663dd64fea8f85967986..ac0319770817a0fc3814e110d29c804744609f82 100755 (executable)
@@ -81,23 +81,19 @@ M: mailbox dispose
 : wait-for-close ( mailbox -- )\r
     f wait-for-close-timeout ;\r
 \r
-TUPLE: linked-error thread ;\r
+TUPLE: linked-error error thread ;\r
 \r
-: <linked-error> ( error thread -- linked )\r
-    { set-delegate set-linked-error-thread }\r
-    linked-error construct ;\r
+C: <linked-error> linked-error\r
 \r
 : ?linked dup linked-error? [ rethrow ] when ;\r
 \r
-TUPLE: linked-thread supervisor ;\r
+TUPLE: linked-thread < thread supervisor ;\r
 \r
 M: linked-thread error-in-thread\r
-    [ <linked-error> ] keep\r
-    linked-thread-supervisor mailbox-put ;\r
+    [ <linked-error> ] [ supervisor>> ] bi mailbox-put ;\r
 \r
 : <linked-thread> ( quot name mailbox -- thread' )\r
-    >r <thread> linked-thread construct-delegate r>\r
-    over set-linked-thread-supervisor ;\r
+    >r linked-thread new-thread r> >>supervisor ;\r
 \r
 : spawn-linked-to ( quot name mailbox -- thread )\r
     <linked-thread> [ (spawn) ] keep ;\r
index acdbca82eebfc68c25a57fa5e650693d6e253551..4e6bfe48881153f52d84b860c438700af278b261 100755 (executable)
@@ -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 <array> } } }
+    { { $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 (file)
index 0000000..e389b41
--- /dev/null
@@ -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 (file)
index 0000000..fe5bd31
--- /dev/null
@@ -0,0 +1 @@
+Iteration with access to next element
index e70c874e98c157c8c741946f26f1eeada25f76ea..46391bbd283ef9435bcafc35c03502ea47a2aee5 100644 (file)
@@ -1 +1 @@
-Splay Trees
+Splay trees