Adding docs on null? and the changes for require-when

db4
Daniel Ehrenberg 2010-04-18 14:44:52 -05:00
parent aa6158b366
commit 26c3bf2611
3 changed files with 12 additions and 6 deletions

View File

@ -23,6 +23,8 @@ ARTICLE: "set-operations" "Operations on sets"
adjoin
delete
}
"To test if a set is the empty set:"
{ $subsections null? }
"Basic mathematical operations, which any type of set may override for efficiency:"
{ $subsections
diff
@ -178,3 +180,7 @@ HELP: within
HELP: without
{ $values { "seq" sequence } { "set" set } { "subseq" sequence } }
{ $description "Returns the subsequence of the given sequence consisting of things that are not members of the set. This may contain duplicates, if the sequence has duplicates." } ;
HELP: null?
{ $values { "set" set } { "?" "a boolean" } }
{ $description "Tests whether the given set is empty. This outputs " { $snippet "t" } " when given a null set of any type." } ;

View File

@ -114,10 +114,10 @@ HELP: require
{ $notes "To unconditionally reload a vocabulary, use " { $link reload } ". To reload changed source files only, use the words in " { $link "vocabs.refresh" } "." } ;
HELP: require-when
{ $values { "if" "a vocabulary specifier" } { "then" "a vocabulary specifier" } }
{ $description "Loads the " { $snippet "then" } " vocabulary if it is not loaded and the " { $snippet "if" } " vocabulary is. If the " { $snippet "if" } " vocabulary is not loaded now, but it is later, then the " { $snippet "then" } " vocabulary will be loaded along with it at that time." }
{ $notes "This is used to express a joint dependency of vocabularies. If vocabularies " { $snippet "a" } " and " { $snippet "b" } " use code in vocabulary " { $snippet "c" } " to interact, then the following line can be placed in " { $snippet "a" } " in order express the dependency."
{ $code "\"b\" \"c\" require-when" } } ;
{ $values { "if" "a sequence of vocabulary specifiers" } { "then" "a vocabulary specifier" } }
{ $description "Loads the " { $snippet "then" } " vocabulary if it is not loaded and all of the " { $snippet "if" } " vocabulary is. If some of the " { $snippet "if" } " vocabularies are not loaded now, but they are later, then the " { $snippet "then" } " vocabulary will be loaded along with the final one." }
{ $notes "This is used to express a joint dependency of vocabularies. If vocabularies " { $snippet "a" } " and " { $snippet "b" } " use code in vocabulary " { $snippet "c" } " to interact, then the following line, which can be placed in " { $snippet "a" } " or " { $snippet "b" } ", expresses the dependency."
{ $code "{ \"a\" \"b\" } \"c\" require-when" } } ;
HELP: run
{ $values { "vocab" "a vocabulary specifier" } }

View File

@ -3,7 +3,7 @@
USING: namespaces make sequences io io.files io.pathnames kernel
assocs words vocabs definitions parser continuations hashtables
sorting source-files arrays combinators strings system
math.parser splitting init accessors sets fry ;
math.parser splitting init accessors sets ;
IN: vocabs.loader
SYMBOL: vocab-roots
@ -76,7 +76,7 @@ require-when-table [ V{ } clone ] initialize
vocab-name require-when-vocabs get in? [
require-when-table get [
[ [ vocab ] all? ] dip
'[ _ require ] when
[ require ] curry when
] assoc-each
] when ;