ARTICLE: "concurrency.distributed.example" "Distributed Concurrency Example"
"In this example the Factor instance associated with port 9000 will run "
"a thread that receives and prints messages "
-"in the listener. The code to start the thread is: "
+"in the listener. The code to start the thread is:"
{ $examples
{ $unchecked-example
": log-message ( -- ) receive . flush log-message ;"
"The " { $vocab-link "concurrency.distributed" } " implements transparent distributed message passing, inspired by Erlang and Termite." $nl
"Instances of " { $link thread } " can be sent to remote threads, at which point they are converted to objects holding the thread ID and the current node's host name:"
{ $subsections remote-thread }
-"The " { $vocab-link "serialize" } " vocabulary is used to convert Factor objects to byte arrays for transfer over a socket."
+"The " { $vocab-link "serialize" } " vocabulary is used to convert Factor objects to byte arrays for transfer over a socket."
{ $subsections "concurrency.distributed.example" } ;
ABOUT: "concurrency.distributed"
{ { $slot "header" } { "An assoc of HTTP header values. See " { $link "http.headers" } } }
{ { $slot "post-data" } { "See " { $link "http.post-data" } } }
{ { $slot "cookies" } { "A sequence of HTTP cookies. See " { $link "http.cookies" } } }
- { { $slot "redirects" } { "Number of redirects to attempt before throwing an error. Default is " { $snippet "max-redirects" } " ." } }
+ { { $slot "redirects" } { "Number of redirects to attempt before throwing an error. Default is " { $snippet "max-redirects" } "." } }
} } ;
HELP: <response>
"Instances contain the following slots:"
{ $table
{ { $slot "data" } { "The POST data. This can be in a higher-level form, such as an assoc of POST parameters, a string, or an XML document" } }
- { { $slot "params" } { "Parameters passed in the POST request." } }
+ { { $slot "params" } { "Parameters passed in the POST request." } }
{ { $slot "content-type" } { "A MIME type" } }
{ { $slot "content-encoding" } { "Encoding used for the POST data" } }
} } ;
$nl
"Providing a SIMD boolean vector with element values other than the proper true and false representations as an input to the vector logical or test operations is undefined. Do not count on operations such as " { $link vall? } " or " { $link v? } " using bitwise operations to construct their results."
$nl
-"This applies to the output of the following element comparison words: "
+"This applies to the output of the following element comparison words:"
{ $list
{ $link v< }
{ $link v<= }
"This parser when run with the string \"++--\" or the array "
"{ CHAR: + CHAR: + CHAR: - CHAR: - } will succeed with an AST of { \"++\" \"--\" }. "
"If you want to add whitespace handling to the grammar you need to put it "
-"between the terminals: "
+"between the terminals:"
{ $examples
{ $code
"EBNF: foo"
"In a large grammar this gets tedious and makes the grammar hard to read. "
"Instead you can write a rule to split the input sequence into tokens, and "
"have the grammar operate on these tokens. This is how the previous example "
-"might look: "
+"might look:"
{ $examples
{ $code
"EBNF: foo"
$nl
"In this example I split the tokenizer into a separate parser and use "
"'foreign' to call it from the main one. This allows testing of the "
-"tokenizer separately: "
+"tokenizer separately:"
{ $examples
{ $example
"USING: prettyprint peg peg.ebnf kernel math.parser strings"
"working in one pass. There is no tokenization occurring over the whole string "
"followed by the parse of that result. It tokenizes as it needs to. You can even "
"switch tokenizers multiple times during a grammar. Rules use the tokenizer that "
-"was defined lexically before the rule. This is usefull in the JavaScript grammar: "
+"was defined lexically before the rule. This is usefull in the JavaScript grammar:"
{ $examples
{ $code
"EBNF: javascript"
POSTPONE: [EBNF
POSTPONE: EBNF:
}
-"The EBNF syntax is composed of a series of rules of the form: "
+"The EBNF syntax is composed of a series of rules of the form:"
{ $code
"rule1 = ..."
"rule2 = ..."
"The last defined rule is the main rule for the EBNF. It is the first one run "
"and it is expected that the remaining rules are used by that rule. Rules may be "
"left recursive. "
-"Each rule can contain the following: "
+"Each rule can contain the following:"
{ $subsections "peg.ebnf.strings"
"peg.ebnf.any"
"peg.ebnf.sequence"
": perform ( value action -- result ) quot>> call( value -- result ) ;"
}
{ $subheading "Passing an unknown quotation to an inline combinator" }
-"Suppose we want to write :"
+"Suppose we want to write:"
{ $code ": perform ( values action -- results ) quot>> map ;" }
"However this fails to pass the stack checker since there is no guarantee the quotation has the right stack effect for " { $link map } ". It can be wrapped in a new quotation with a declaration:"
{ $code ": perform ( values action -- results )" " quot>> [ call( value -- result ) ] curry map ;" }
IN: classes
ARTICLE: "class-predicates" "Class predicate words"
-"With a handful of exceptions, each class has a membership predicate word, named " { $snippet { $emphasis "class" } "?" } " . A quotation calling this predicate is stored in the " { $snippet "\"predicate\"" } " word property."
+"With a handful of exceptions, each class has a membership predicate word, named " { $snippet { $emphasis "class" } "?" } ". A quotation calling this predicate is stored in the " { $snippet "\"predicate\"" } " word property."
$nl
"When it comes to predicates, the exceptional classes are:"
{ $table
HELP: superclass
{ $values { "class" class } { "super" class } }
{ $description "Outputs the superclass of a class. All instances of this class are also instances of the superclass." }
-{ $examples
+{ $examples
{ $example "USING: classes prettyprint ;"
"t superclass ."
"word"
{ "class" class }
{ "supers" sequence } }
{ $description "Outputs a sequence of superclasses of a class along with the class itself." }
-{ $examples
+{ $examples
{ $example "USING: classes prettyprint ;"
"t superclasses ."
"{ word t }"
{ "?" boolean }
}
{ $description "Outputs a boolean value indicating whether " { $snippet "class" } " is at any level a subclass of " { $snippet "superclass" } "." }
-{ $examples
+{ $examples
{ $example "USING: classes classes.tuple prettyprint words ;"
"tuple-class \\ class subclass-of? ."
"t"
! Copyright (C) 2010 Jon Harper.
! See http://factorcode.org/license.txt for BSD license.
-USING: help.markup help.syntax kernel strings io.pathnames images
+USING: help.markup help.syntax kernel strings io.pathnames images
models opengl.textures classes ui.gadgets ;
IN: images.viewer
}
{ $description "Removes the connection between the gadget and it's model" } ;
ARTICLE: "images.viewer" "Displaying Images"
-"The " { $vocab-link "images.viewer" } " vocabulary uses the " { $vocab-link "opengl.textures" }
-" vocabulary to display any instance of " { $link image } "."$nl
-"An " { $link image-gadget } " can be used for static images and " { $instance image-control }
-" for changing images (for example a video feed). For changing images, the image should be containted in " { $instance model }
+"The " { $vocab-link "images.viewer" } " vocabulary uses the " { $vocab-link "opengl.textures" }
+" vocabulary to display any instance of " { $link image } "."$nl
+"An " { $link image-gadget } " can be used for static images and " { $instance image-control }
+" for changing images (for example a video feed). For changing images, the image should be containted in " { $instance model }
". Change the model value with " { $link set-model } " or mutate the image and call "
{ $link notify-connections } " when you want to update the image. To stop refreshing the image, call " { $link stop-control } "."
" To start refreshing again, call " { $link start-control } "."
{ $subsections <image-gadget> <image-control> }
"The " { $link image } " or " { $link model }
" can also be given after the construction of the object. In this case, use "
-{ $link new-image-gadget } " and " { $link set-image } "."
+{ $link new-image-gadget } " and " { $link set-image } "."
" The gadget will automatically detect if the image changes size or format and reallocate a new texture if needed."
" This means images can be set even after the gadget has been grafted. Grafted gadgets without an image will display a blank screen."
{ $notes "The image can be set after the gadget has been grafted. However, for " { $instance image-gadget } ", this can "
-" be done only once. If your image is changing, you should be using " { $instance image-control } " and " { $instance model } "."
+" be done only once. If your image is changing, you should be using " { $instance image-control } " and " { $instance model } "."
$nl
" Performance will be greatly reduced if you are using images that have more than 512 pixels on one of their"
" axis." }
$nl
-"Utility words for displaying images :"
+"Utility words for displaying images:"
{ $subsections
image. image-window }