Merge branch 'master' of git://github.com/slavapestov/factor

db4
John Benediktsson 2011-02-14 22:19:34 -08:00
commit 2005df3b0c
16 changed files with 57 additions and 55 deletions

View File

@ -27,7 +27,7 @@ HELP: HEXCOLOR:
ARTICLE: "colors.hex" "HEX colors" ARTICLE: "colors.hex" "HEX colors"
"The " { $vocab-link "colors.hex" } " vocabulary implements colors specified " "The " { $vocab-link "colors.hex" } " vocabulary implements colors specified "
"by their hexidecimal value." "by their hexadecimal value."
{ $subsections { $subsections
hex>rgba hex>rgba
rgba>hex rgba>hex

View File

@ -8,7 +8,7 @@ HELP: articles
HELP: no-article HELP: no-article
{ $values { "name" "an article name" } } { $values { "name" "an article name" } }
{ $description "Throws a " { $link no-article } " error." } { $description "Throws a " { $link no-article } " error." }
{ $error-description "Thrown by " { $link help } " if the given help topic does not exist, or if the help topic being dispayed links to a help topic which does not exist." } ; { $error-description "Thrown by " { $link help } " if the given help topic does not exist, or if the help topic being displayed links to a help topic which does not exist." } ;
HELP: article HELP: article
{ $values { "name" "an article name" } { "article" "an " { $link article } " object" } } { $values { "name" "an article name" } { "article" "an " { $link article } " object" } }

View File

@ -143,7 +143,7 @@ HELP: <inet6>
{ $description "Creates a new " { $link inet6 } " address specifier. A value of " { $link f } " as the host refers to localhost, while " { $link f } " as the port defers the port choice until a later time." } ; { $description "Creates a new " { $link inet6 } " address specifier. A value of " { $link f } " as the host refers to localhost, while " { $link f } " as the port defers the port choice until a later time." } ;
HELP: <client> HELP: <client>
{ $values { "remote" "an address specifier" } { "encoding" "an encding descriptor" } { "stream" "a bidirectional stream" } { "local" "an address specifier" } } { $values { "remote" "an address specifier" } { "encoding" "an encoding descriptor" } { "stream" "a bidirectional stream" } { "local" "an address specifier" } }
{ $description "Opens a network connection and outputs a bidirectional stream using the given encoding, together with the local address the socket was bound to." } { $description "Opens a network connection and outputs a bidirectional stream using the given encoding, together with the local address the socket was bound to." }
{ $errors "Throws an error if the connection cannot be established." } { $errors "Throws an error if the connection cannot be established." }
{ $notes "The " { $link with-client } " word is easier to use in most situations." } { $notes "The " { $link with-client } " word is easier to use in most situations." }
@ -225,7 +225,7 @@ HELP: with-local-address
{ $description "Client sockets opened within the scope of the quotation passed to this combinator will have their local address bound to the given address." } { $description "Client sockets opened within the scope of the quotation passed to this combinator will have their local address bound to the given address." }
{ $examples { $examples
{ "Binds the local address of a newly created client socket within the quotation to 127.0.0.1." { "Binds the local address of a newly created client socket within the quotation to 127.0.0.1."
"This ensures that all traffic originates from the given address (the port is choosen by the TCP stack)." } "This ensures that all traffic originates from the given address (the port is chosen by the TCP stack)." }
{ $code "\"127.0.0.1\" 0 <inet4> [ ] with-local-address" } { $code "\"127.0.0.1\" 0 <inet4> [ ] with-local-address" }
$nl $nl
{ "Binds the local address of a newly created client socket within the quotation to the local address 192.168.0.1 and the local port 23000. " { "Binds the local address of a newly created client socket within the quotation to the local address 192.168.0.1 and the local port 23000. "

View File

@ -16,9 +16,9 @@ HELP: MACRO:
{ $examples { $examples
"A macro that calls a quotation but preserves any values it consumes off the stack:" "A macro that calls a quotation but preserves any values it consumes off the stack:"
{ $code { $code
"USING: fry generalizations ;" "USING: fry generalizations kernel macros stack-checker ;"
"MACRO: preserving ( quot -- )" "MACRO: preserving ( quot -- )"
" [ infer in>> length ] keep '[ _ ndup @ ] ;" " [ inputs ] keep '[ _ ndup @ ] ;"
} }
"Using this macro, we can define a variant of " { $link if } " which takes a predicate quotation instead of a boolean; any values consumed by the predicate quotation are restored immediately after:" "Using this macro, we can define a variant of " { $link if } " which takes a predicate quotation instead of a boolean; any values consumed by the predicate quotation are restored immediately after:"
{ $code { $code

View File

@ -323,7 +323,7 @@ HELP: assoc-stack
HELP: value-at* HELP: value-at*
{ $values { "value" object } { "assoc" assoc } { "key/f" "the key associated to the value, or " { $link f } } { "?" boolean } } { $values { "value" object } { "assoc" assoc } { "key/f" "the key associated to the value, or " { $link f } } { "?" boolean } }
{ $description "Looks up the key associated with a value. The boolean flag can decide beteen the case of a missing key, and a key of " { $link f } "." } ; { $description "Looks up the key associated with a value. The boolean flag can decide between the case of a missing key, and a key of " { $link f } "." } ;
HELP: value-at HELP: value-at
{ $values { "value" object } { "assoc" assoc } { "key/f" "the key associated to the value, or " { $link f } } } { $values { "value" object } { "assoc" assoc } { "key/f" "the key associated to the value, or " { $link f } } }
@ -438,7 +438,7 @@ HELP: assoc-map-as
{ $values { $values
{ "assoc" assoc } { "quot" { $quotation "( ... key value -- ... newkey newvalue )" } } { "exemplar" assoc } { "assoc" assoc } { "quot" { $quotation "( ... key value -- ... newkey newvalue )" } } { "exemplar" assoc }
{ "newassoc" assoc } } { "newassoc" assoc } }
{ $description "Applies the quotation to each entry in the input assoc and collects the results in a new assoc of the stame type as the exemplar." } { $description "Applies the quotation to each entry in the input assoc and collects the results in a new assoc of the same type as the exemplar." }
{ $examples { $example "USING: prettyprint assocs hashtables math ;" " H{ { 1 2 } { 3 4 } } [ sq ] { } assoc-map-as ." "{ { 1 4 } { 3 16 } }" } } ; { $examples { $example "USING: prettyprint assocs hashtables math ;" " H{ { 1 2 } { 3 4 } } [ sq ] { } assoc-map-as ." "{ { 1 4 } { 3 16 } }" } } ;
HELP: extract-keys HELP: extract-keys
@ -467,7 +467,7 @@ HELP: search-alist
{ "key" object } { "alist" "an array of key/value pairs" } { "key" object } { "alist" "an array of key/value pairs" }
{ "pair/f" "a key/value pair" } { "i/f" integer } } { "pair/f" "a key/value pair" } { "i/f" integer } }
{ $description "Iterates over " { $snippet "alist" } " and stops when the key is matched or the end of the " { $snippet "alist" } " has been reached. If there is no match, both outputs are " { $link f } "." } { $description "Iterates over " { $snippet "alist" } " and stops when the key is matched or the end of the " { $snippet "alist" } " has been reached. If there is no match, both outputs are " { $link f } "." }
{ $notes "This word is used to implement " { $link at* } " and " { $link set-at } " on sequences, and should not be called direclty." } { $notes "This word is used to implement " { $link at* } " and " { $link set-at } " on sequences, and should not be called directly." }
{ $examples { $example "USING: prettyprint assocs.private kernel ;" { $examples { $example "USING: prettyprint assocs.private kernel ;"
"3 { { 1 2 } { 3 4 } } search-alist [ . ] bi@" "3 { { 1 2 } { 3 4 } } search-alist [ . ] bi@"
"{ 3 4 }\n1" "{ 3 4 }\n1"

View File

@ -326,12 +326,14 @@ HELP: cond
} }
{ $errors "Throws a " { $link no-cond } " error if none of the test quotations yield a true value." } { $errors "Throws a " { $link no-cond } " error if none of the test quotations yield a true value." }
{ $examples { $examples
{ $code { $example
"{" "USING: combinators io kernel math ;"
" { [ dup 0 > ] [ \"positive\" ] }" "0 {"
" { [ dup 0 < ] [ \"negative\" ] }" " { [ dup 0 > ] [ drop \"positive\" ] }"
" [ \"zero\" ]" " { [ dup 0 < ] [ drop \"negative\" ] }"
"} cond" " [ drop \"zero\" ]"
"} cond print"
"zero"
} }
} ; } ;

View File

@ -265,7 +265,7 @@ HELP: return
HELP: with-return HELP: with-return
{ $values { $values
{ "quot" quotation } } { "quot" quotation } }
{ $description "Captures a continuation that can be reified by calling the " { $link return } " word. If so, it will resume execution immediatly after the " { $link with-return } " word. If " { $link return } " is not called, then execution proceeds as if this word were simply " { $link call } "." } { $description "Captures a continuation that can be reified by calling the " { $link return } " word. If so, it will resume execution immediately after the " { $link with-return } " word. If " { $link return } " is not called, then execution proceeds as if this word were simply " { $link call } "." }
{ $examples { $examples
"Only \"Hi\" will print:" "Only \"Hi\" will print:"
{ $example { $example

View File

@ -850,7 +850,7 @@ HELP: C:
"The following two lines are equivalent:" "The following two lines are equivalent:"
{ $code { $code
"C: <color> color" "C: <color> color"
": <color> color boa ;" ": <color> ( red green blue -- color ) color boa ;"
} }
"In both cases, a word " { $snippet "<color>" } " is defined, which reads three values from the stack and creates a " { $snippet "color" } " instance having these values in the " { $snippet "red" } ", " { $snippet "green" } " and " { $snippet "blue" } " slots, respectively." "In both cases, a word " { $snippet "<color>" } " is defined, which reads three values from the stack and creates a " { $snippet "color" } " instance having these values in the " { $snippet "red" } ", " { $snippet "green" } " and " { $snippet "blue" } " slots, respectively."
} ; } ;

View File

@ -165,7 +165,7 @@ ARTICLE: "words" "Words"
$nl $nl
"There are two ways of creating word definitions:" "There are two ways of creating word definitions:"
{ $list { $list
"using parsing words at parse time," "using parsing words at parse time."
"using defining words at run time." "using defining words at run time."
} }
"The latter is a more dynamic feature that can be used to implement code generation and such, and in fact parse time defining words are implemented in terms of run time defining words." "The latter is a more dynamic feature that can be used to implement code generation and such, and in fact parse time defining words are implemented in terms of run time defining words."