update some docs that should use $quotation.

db4
John Benediktsson 2012-09-27 11:09:17 -07:00
parent c93fd319b3
commit 225e87339b
9 changed files with 36 additions and 36 deletions

View File

@ -83,23 +83,23 @@ HELP: nappend-as
{ nappend nappend-as } related-words { nappend nappend-as } related-words
HELP: neach HELP: neach
{ $values { "seq..." { $snippet "n" } " sequences on the datastack" } { "quot" "a quotation with stack effect " { $snippet "( element... -- )" } } { "n" integer } } { $values { "seq..." { $snippet "n" } " sequences on the datastack" } { "quot" { $quotation "( element... -- )" } } { "n" integer } }
{ $description "A generalization of " { $link each } ", " { $link 2each } ", and " { $link 3each } " that can iterate over any number of sequences in parallel." } ; { $description "A generalization of " { $link each } ", " { $link 2each } ", and " { $link 3each } " that can iterate over any number of sequences in parallel." } ;
HELP: nmap HELP: nmap
{ $values { "seq..." { $snippet "n" } " sequences on the datastack" } { "quot" "a quotation with stack effect " { $snippet "( element... -- result )" } } { "n" integer } { "result" "a sequence of the same type as the first " { $snippet "seq" } } } { $values { "seq..." { $snippet "n" } " sequences on the datastack" } { "quot" { $quotation "( element... -- result )" } } { "n" integer } { "result" "a sequence of the same type as the first " { $snippet "seq" } } }
{ $description "A generalization of " { $link map } ", " { $link 2map } ", and " { $link 3map } " that can map over any number of sequences in parallel." } ; { $description "A generalization of " { $link map } ", " { $link 2map } ", and " { $link 3map } " that can map over any number of sequences in parallel." } ;
HELP: nmap-as HELP: nmap-as
{ $values { "seq..." { $snippet "n" } " sequences on the datastack" } { "quot" "a quotation with stack effect " { $snippet "( element... -- result )" } } { "exemplar" sequence } { "n" integer } { "result" "a sequence of the same type as " { $snippet "exemplar" } } } { $values { "seq..." { $snippet "n" } " sequences on the datastack" } { "quot" { $quotation "( element... -- result )" } } { "exemplar" sequence } { "n" integer } { "result" "a sequence of the same type as " { $snippet "exemplar" } } }
{ $description "A generalization of " { $link map-as } ", " { $link 2map-as } ", and " { $link 3map-as } " that can map over any number of sequences in parallel." } ; { $description "A generalization of " { $link map-as } ", " { $link 2map-as } ", and " { $link 3map-as } " that can map over any number of sequences in parallel." } ;
HELP: mnmap HELP: mnmap
{ $values { "m*seq" { $snippet "m" } " sequences on the datastack" } { "quot" "a quotation with stack effect " { $snippet "( m*element -- result*n )" } } { "m" integer } { "n" integer } { "result*n" { $snippet "n" } " sequences of the same type as the first " { $snippet "seq" } } } { $values { "m*seq" { $snippet "m" } " sequences on the datastack" } { "quot" { $quotation "( m*element -- result*n )" } } { "m" integer } { "n" integer } { "result*n" { $snippet "n" } " sequences of the same type as the first " { $snippet "seq" } } }
{ $description "A generalization of " { $link map } ", " { $link 2map } ", and " { $link 3map } " that can map over any number of sequences in parallel and provide any number of output sequences." } ; { $description "A generalization of " { $link map } ", " { $link 2map } ", and " { $link 3map } " that can map over any number of sequences in parallel and provide any number of output sequences." } ;
HELP: mnmap-as HELP: mnmap-as
{ $values { "m*seq" { $snippet "m" } " sequences on the datastack" } { "quot" "a quotation with stack effect " { $snippet "( m*element -- result*n )" } } { "n*exemplar" { $snippet "n" } " sequences on the datastack" } { "m" integer } { "n" integer } { "result*n" { $snippet "n" } " sequences on the datastack of the same types as the " { $snippet "exemplar" } "s" } } { $values { "m*seq" { $snippet "m" } " sequences on the datastack" } { "quot" { $quotation "( m*element -- result*n )" } } { "n*exemplar" { $snippet "n" } " sequences on the datastack" } { "m" integer } { "n" integer } { "result*n" { $snippet "n" } " sequences on the datastack of the same types as the " { $snippet "exemplar" } "s" } }
{ $description "A generalization of " { $link map-as } ", " { $link 2map-as } ", and " { $link 3map-as } " that can map over any number of sequences in parallel and provide any number of output sequences of distinct types." } ; { $description "A generalization of " { $link map-as } ", " { $link 2map-as } ", and " { $link 3map-as } " that can map over any number of sequences in parallel and provide any number of output sequences of distinct types." } ;
HELP: nproduce HELP: nproduce
@ -111,7 +111,7 @@ HELP: nproduce-as
{ $description "A generalization of " { $link produce-as } " that generates " { $snippet "n" } " sequences in parallel by calling " { $snippet "quot" } " repeatedly until " { $snippet "pred" } " outputs false." } ; { $description "A generalization of " { $link produce-as } " that generates " { $snippet "n" } " sequences in parallel by calling " { $snippet "quot" } " repeatedly until " { $snippet "pred" } " outputs false." } ;
HELP: nmap-reduce HELP: nmap-reduce
{ $values { "map-quot" quotation } { "reduce-quot" quotation } { "n" integer } } { $values { "map-quot" { $quotation "( element... -- intermediate )" } } { "reduce-quot" { $quotation "( prev intermediate -- next )" } } { "n" integer } }
{ $description "A generalization of " { $link map-reduce } " that can be applied to any number of sequences." } ; { $description "A generalization of " { $link map-reduce } " that can be applied to any number of sequences." } ;
ARTICLE: "sequences.generalizations" "Generalized sequence words" ARTICLE: "sequences.generalizations" "Generalized sequence words"

View File

@ -11,7 +11,7 @@ $nl
"Presentations have two slots:" "Presentations have two slots:"
{ $list { $list
{ { $snippet "object" } " - the object being presented." } { { $snippet "object" } " - the object being presented." }
{ { $snippet "hook" } " - a quotation with stack effect " { $snippet "( presentation -- )" } ". The default value is " { $snippet "[ drop ]" } "." } { { $snippet "hook" } " - " { $quotation "( presentation -- )" } ". The default value is " { $snippet "[ drop ]" } "." }
} } ; } } ;
HELP: invoke-presentation HELP: invoke-presentation

View File

@ -22,10 +22,10 @@ HELP: operation
$nl $nl
"Operations have the following slots:" "Operations have the following slots:"
{ $list { $list
{ { $snippet "predicate" } " - a quotation with stack effect " { $snippet "( obj -- ? )" } } { { $snippet "predicate" } " - " { $quotation "( obj -- ? )" } }
{ { $snippet "command" } " - a " { $link word } } { { $snippet "command" } " - a " { $link word } }
{ { $snippet "translator" } " - a quotation with stack effect " { $snippet "( obj -- newobj )" } ", or " { $link f } } { { $snippet "translator" } " - " { $quotation "( obj -- newobj )" } ", or " { $link f } }
{ { $snippet "hook" } " - a quotation with stack effect " { $snippet "( obj -- newobj )" } ", or " { $link f } } { { $snippet "hook" } " - " { $quotation "( obj -- newobj )" } ", or " { $link f } }
{ { $snippet "listener?" } " - a boolean" } { { $snippet "listener?" } " - a boolean" }
} } ; } } ;

View File

@ -1,5 +1,5 @@
USING: assocs hashtables help.markup help.syntax kernel sequences ;
IN: graphs IN: graphs
USING: help.markup help.syntax kernel assocs hashtables ;
ARTICLE: "graphs" "Directed graph utilities" ARTICLE: "graphs" "Directed graph utilities"
"Words for treating associative mappings as directed graphs can be found in the " { $vocab-link "graphs" } " vocabulary. A directed graph is represented as an assoc mapping each vertex to a set of edges entering that vertex, where the set is itself an assoc, with equal keys and values." "Words for treating associative mappings as directed graphs can be found in the " { $vocab-link "graphs" } " vocabulary. A directed graph is represented as an assoc mapping each vertex to a set of edges entering that vertex, where the set is itself an assoc, with equal keys and values."
@ -17,16 +17,16 @@ $nl
ABOUT: "graphs" ABOUT: "graphs"
HELP: add-vertex HELP: add-vertex
{ $values { "vertex" object } { "edges" "a sequence" } { "graph" "an assoc mapping vertices to sequences of edges" } } { $values { "vertex" object } { "edges" sequence } { "graph" "an assoc mapping vertices to sequences of edges" } }
{ $description "Adds a vertex to a directed graph, with " { $snippet "edges" } " as the outward edges from the vertex." } { $description "Adds a vertex to a directed graph, with " { $snippet "edges" } " as the outward edges from the vertex." }
{ $side-effects "graph" } ; { $side-effects "graph" } ;
HELP: remove-vertex HELP: remove-vertex
{ $values { "vertex" object } { "edges" "a sequence" } { "graph" "an assoc mapping vertices to sequences of edges" } } { $values { "vertex" object } { "edges" sequence } { "graph" "an assoc mapping vertices to sequences of edges" } }
{ $description "Removes a vertex from a graph, using the given edges sequence." } { $description "Removes a vertex from a graph, using the given edges sequence." }
{ $notes "The " { $snippet "edges" } " sequence must equal the value passed to " { $link add-vertex } ", otherwise some vertices of the graph may continue to refer to the removed vertex." } { $notes "The " { $snippet "edges" } " sequence must equal the value passed to " { $link add-vertex } ", otherwise some vertices of the graph may continue to refer to the removed vertex." }
{ $side-effects "graph" } ; { $side-effects "graph" } ;
HELP: closure HELP: closure
{ $values { "obj" object } { "quot" "a a quotation with stack effect " { $snippet "( obj -- assoc )" } } { "assoc" "a new assoc" } } { $values { "obj" object } { "quot" { $quotation "( obj -- assoc )" } } { "assoc" "a new assoc" } }
{ $description "Outputs a set of all vertices reachable from " { $snippet "vertex" } " via edges given by the quotation. The set always includes " { $snippet "vertex" } "." } ; { $description "Outputs a set of all vertices reachable from " { $snippet "vertex" } " via edges given by the quotation. The set always includes " { $snippet "vertex" } "." } ;

View File

@ -1344,7 +1344,7 @@ HELP: insert-nth
HELP: map-reduce HELP: map-reduce
{ $values { $values
{ "seq" sequence } { "map-quot" quotation } { "reduce-quot" quotation } { "seq" sequence } { "map-quot" { $quotation "( ..a x -- ..b elt )" } } { "reduce-quot" { $quotation "( ..b prev elt -- ..a next )" } }
{ "result" object } } { "result" object } }
{ $description "Calls " { $snippet "map-quot" } " on each element and combines the results using " { $snippet "reduce-quot" } " in the same manner as " { $link reduce } ", except that there is no identity element, and the sequence must have a length of at least 1." } { $description "Calls " { $snippet "map-quot" } " on each element and combines the results using " { $snippet "reduce-quot" } " in the same manner as " { $link reduce } ", except that there is no identity element, and the sequence must have a length of at least 1." }
{ $errors "Throws an error if the sequence is empty." } { $errors "Throws an error if the sequence is empty." }

View File

@ -1,6 +1,6 @@
! Copyright (c) 2009 Samuel Tardieu. ! Copyright (c) 2009 Samuel Tardieu.
! See See http://factorcode.org/license.txt for BSD license. ! See See http://factorcode.org/license.txt for BSD license.
USING: help.markup help.syntax ; USING: help.markup help.syntax quotations sequences ;
IN: backtrack IN: backtrack
HELP: fail HELP: fail
@ -30,15 +30,15 @@ HELP: amb-execute
HELP: if-amb HELP: if-amb
{ $values { $values
{ "true" "a quotation with stack effect ( -- ? )" } { "true" { $quotation "( -- ? )" } }
{ "false" "a quotation" } { "false" quotation }
{ "?" "a boolean" } { "?" "a boolean" }
} }
{ $description "Execute the first quotation and returns " { $link t } " if it returns " { $link t } " itself. If it fails with " { $link fail } " or returns " { $link f } ", then the second quotation is executed and " { $link f } " is returned." } ; { $description "Execute the first quotation and returns " { $link t } " if it returns " { $link t } " itself. If it fails with " { $link fail } " or returns " { $link f } ", then the second quotation is executed and " { $link f } " is returned." } ;
HELP: amb-all HELP: amb-all
{ $values { $values
{ "quot" "a quotation with stack effect ( -- )" } { "quot" { $quotation "( -- )" } }
} }
{ $description "Execute all the alternatives in the quotation by calling " { $link fail } " repeatedly at the end." } { $description "Execute all the alternatives in the quotation by calling " { $link fail } " repeatedly at the end." }
{ $see-also bag-of fail } { $see-also bag-of fail }
@ -46,8 +46,8 @@ HELP: amb-all
HELP: bag-of HELP: bag-of
{ $values { $values
{ "quot" "a quotation with stack effect ( -- result )" } { "quot" { $quotation "( -- result )" } }
{ "seq" "a sequence" } { "seq" sequence }
} }
{ $description "Execute all the alternatives in the quotation and collect the results." } { $description "Execute all the alternatives in the quotation and collect the results." }
{ $see-also amb-all } ; { $see-also amb-all } ;

View File

@ -1,56 +1,56 @@
! Copyright (C) 2005 Chris Double, 2007 Clemens Hofreither, 2008 James Cash. ! Copyright (C) 2005 Chris Double, 2007 Clemens Hofreither, 2008 James Cash.
USING: help.markup help.syntax ; USING: help.markup help.syntax kernel ;
IN: coroutines IN: coroutines
HELP: cocreate HELP: cocreate
{ $values { "quot" "a quotation with stack effect ( value -- )" } { "co" "a coroutine" } } { $values { "quot" { $quotation "( value -- )" } } { "co" coroutine } }
{ $description "Create a new coroutine which will execute the quotation when resumed. The quotation will have an initial value (received from " { $link coresume } ") on the stack when first resumed.\n\nCoroutines should never terminate normally by \"falling off\" the end of the quotation; instead, they should call " { $link coterminate } "." } { $description "Create a new coroutine which will execute the quotation when resumed. The quotation will have an initial value (received from " { $link coresume } ") on the stack when first resumed.\n\nCoroutines should never terminate normally by \"falling off\" the end of the quotation; instead, they should call " { $link coterminate } "." }
; ;
HELP: coresume HELP: coresume
{ $values { "v" "an object" } { "co" "a coroutine" } { "result" "an object" } } { $values { "v" object } { "co" coroutine } { "result" object } }
{ $description "Resume a coroutine with v as the first item on the stack. The result placed on the stack is the value of the topmost argument on the stack when " { $link coyield } " is called within the coroutine." } { $description "Resume a coroutine with v as the first item on the stack. The result placed on the stack is the value of the topmost argument on the stack when " { $link coyield } " is called within the coroutine." }
{ $see-also *coresume coresume* } { $see-also *coresume coresume* }
; ;
HELP: *coresume HELP: *coresume
{ $values { "co" "a coroutine" } { "result" "an object" } } { $values { "co" coroutine } { "result" object } }
{ $description "Variant of " { $link coresume } " that passes a default value of " { $link f } " to the coroutine." } { $description "Variant of " { $link coresume } " that passes a default value of " { $link f } " to the coroutine." }
{ $see-also coresume coresume* } { $see-also coresume coresume* }
; ;
HELP: coresume* HELP: coresume*
{ $values { "v" "an object" } { "co" "a coroutine" } } { $values { "v" object } { "co" coroutine } }
{ $description "Variant of " { $link coresume } " that discards the result of the coroutine invocation." } { $description "Variant of " { $link coresume } " that discards the result of the coroutine invocation." }
{ $see-also coresume *coresume } { $see-also coresume *coresume }
; ;
HELP: coyield HELP: coyield
{ $values { "v" "an object" } { "result" "an object" } } { $values { "v" object } { "result" object } }
{ $description "Suspend the current coroutine, leaving the value v on the stack when control is passed to the " { $link coresume } " caller. When this coroutine is later resumed, result will contain the value passed to " { $link coyield } "." } { $description "Suspend the current coroutine, leaving the value v on the stack when control is passed to the " { $link coresume } " caller. When this coroutine is later resumed, result will contain the value passed to " { $link coyield } "." }
{ $see-also *coyield coyield* coterminate } { $see-also *coyield coyield* coterminate }
; ;
HELP: *coyield HELP: *coyield
{ $values { "v" "an object" } } { $values { "v" object } }
{ $description "Variant of " { $link coyield } " that returns a default value of " { $link f } " to the caller." } { $description "Variant of " { $link coyield } " that returns a default value of " { $link f } " to the caller." }
{ $see-also coyield coyield* } { $see-also coyield coyield* }
; ;
HELP: coyield* HELP: coyield*
{ $values { "v" "an object" } } { $values { "v" object } }
{ $description "Variant of " { $link coyield } " that discards the value passed in via " { $link coresume } "." } { $description "Variant of " { $link coyield } " that discards the value passed in via " { $link coresume } "." }
{ $see-also coyield *coyield } { $see-also coyield *coyield }
; ;
HELP: coterminate HELP: coterminate
{ $values { "v" "an object" } } { $values { "v" object } }
{ $description "Terminate the current coroutine, leaving the value v on the stack when control is passed to the " { $link coresume } " caller. Resuming a terminated coroutine is a no-op." } { $description "Terminate the current coroutine, leaving the value v on the stack when control is passed to the " { $link coresume } " caller. Resuming a terminated coroutine is a no-op." }
{ $see-also coyield coreset } { $see-also coyield coreset }
; ;
HELP: coreset HELP: coreset
{ $values { "v" "an object" } } { $values { "v" object } }
{ $description "Reset the current coroutine, leaving the value v on the stack when control is passed to the " { $link coresume } " caller. When the coroutine is resumed, it will continue at the beginning of the coroutine." } { $description "Reset the current coroutine, leaving the value v on the stack when control is passed to the " { $link coresume } " caller. When the coroutine is resumed, it will continue at the beginning of the coroutine." }
{ $see-also coyield coterminate } { $see-also coyield coterminate }
; ;

View File

@ -42,9 +42,9 @@ HELP: neighbours
HELP: <astar> HELP: <astar>
{ $values { $values
{ "neighbours" "a quotation with stack effect ( node -- seq )" } { "neighbours" { $quotation "( node -- seq )" } }
{ "cost" "a quotation with stack effect ( from to -- cost )" } { "cost" { $quotation "( from to -- cost )" } }
{ "heuristic" "a quotation with stack effect ( pos target -- cost )" } { "heuristic" { $quotation "( pos target -- cost )" } }
{ "astar" astar } { "astar" astar }
} }
{ $description "Build an astar object from the given quotations. The " { $description "Build an astar object from the given quotations. The "

View File

@ -14,7 +14,7 @@ HELP: readline
HELP: set-completion HELP: set-completion
{ $values { $values
{ "quot" "a quotation with stack effect ( str n -- str )"} { "quot" { $quotation "( str n -- str )" } }
} }
{ $description "Set the given quotation as the completion hook for readline. The quotation is called with the string to complete and the index in the completion list to return. When all completions have been returned, returning " { $snippet "f" } " terminates the loop." } { $description "Set the given quotation as the completion hook for readline. The quotation is called with the string to complete and the index in the completion list to return. When all completions have been returned, returning " { $snippet "f" } " terminates the loop." }
{ $examples { $examples