Small fixes

darcs
slava 2006-06-21 03:26:41 +00:00
parent 895a38fe5a
commit 8ca7993d0f
8 changed files with 20 additions and 11 deletions

View File

@ -209,6 +209,7 @@ sequences vectors words ;
"/library/continuations.facts"
"/library/errors.facts"
"/library/kernel.facts"
"/library/modules.facts"
"/library/quotations.facts"
"/library/threads.facts"
"/library/words.facts"

View File

@ -61,9 +61,6 @@ SYMBOL: building
IN: sequences
: prune ( seq -- seq )
[ [ dup set ] each ] make-hash hash-keys ;
: concat ( seq -- seq )
dup empty? [ [ [ % ] each ] over first make ] unless ;

View File

@ -123,10 +123,6 @@ HELP: init-namespaces "( -- )"
{ $code "[ init-namestack do-some-work ] in-thread" }
} ;
HELP: prune "( seq -- newseq )"
{ $values { "seq" "a sequence" } { "newseq" "a sequence" } }
{ $description "Outputs a new sequence with each distinct element of " { $snippet "seq" } " appearing only once. Elements are compared for equality using " { $link = } " and the ordering of elements in the new sequence is arbitrary." } ;
HELP: concat "( seq -- newseq )"
{ $values { "seq" "a sequence" } { "newseq" "a sequence" } }
{ $description "Concatenates a sequence of sequences together into one sequence. The resulting sequence is of the same class as the first element of " { $snippet "seq" } "." }

View File

@ -58,6 +58,9 @@ M: object like drop ;
: push-new ( elt seq -- ) [ delete ] 2keep push ;
: prune ( seq -- seq )
[ V{ } clone swap [ over push-new ] each ] keep like ;
: nappend ( to from -- )
>r [ length ] keep r> copy-into ; inline

View File

@ -74,6 +74,10 @@ HELP: push-new "( elt seq -- )"
{ $side-effects "seq" }
{ $see-also push } ;
HELP: prune "( seq -- newseq )"
{ $values { "seq" "a sequence" } { "newseq" "a sequence" } }
{ $description "Outputs a new sequence with each distinct element of " { $snippet "seq" } " appearing only once. Elements are compared for equality using " { $link = } " and elements are ordered according to their position in " { $snippet "seq" } "." } ;
HELP: nappend "( dest src -- )"
{ $values { "n" "an index in " { $snippet "dest" } } { "dest" "a resizable mutable sequence" } { "src" "a sequence" } }
{ $description "Appends " { $snippet "src" } " to the end of " { $snippet "dest" } "." }

View File

@ -43,7 +43,7 @@ DEFER: $subsection
[ drop ] [ [ (where) ] each ] if ;
: where ( article -- seq )
[ (where) ] { } make 1 swap tail ;
[ (where) ] { } make 1 swap tail prune ;
: $where ( article -- )
where dup empty? [

View File

@ -34,13 +34,13 @@ HELP: where "( topic -- seq )"
HELP: xref-article "( topic -- )"
{ $values { "topic" "an article name or a word" } }
{ $description "Adds an article to the " { $link link-graph } " and " { $link parent-graph } " graphs." }
{ $description "Adds an article to the " { $link parent-graph } " graph." }
$low-level-note ;
HELP: unxref-article "( topic -- )"
{ $values { "topic" "an article name or a word" } }
{ $description "Removes an article to the " { $link link-graph } " and " { $link parent-graph } " graphs." }
{ $description "Removes an article to the " { $link parent-graph } " graph." }
$low-level-note ;
HELP: xref-articles "( -- )"
{ $description "Update the " { $link link-graph } " and " { $link parent-graph } " graphs. Usually this is done automatically." } ;
{ $description "Update the " { $link parent-graph } ". Usually this is done automatically." } ;

View File

@ -233,3 +233,11 @@ $terpri
{ $contract "The definition must only have one output, the new tuple itself." }
{ $notes "Each tuple class defines a default constructor that reads slot values from the stack. This parsing word redefines the default constructor." }
{ $see-also define-constructor } ;
HELP: REQUIRES: "modules... ;"
{ $values { "modules" "module name strings" } }
{ $description "Loads a list of modules by calling " { $link (require) " on each one." } ;
HELP: PROVIDE: "name files tests ;"
{ $values { "name" "a string" } { "files" "a sequence of strings" } { "tests" "a sequence of strings" } }
{ $description "Registers a module definition and loads its source files by calling " { $link provide } "." } ;