factor: fix docs.
parent
542eecab1c
commit
c8271bb9f7
|
@ -119,7 +119,7 @@ $nl
|
||||||
"Quotations also implement the sequence protocol, and can be manipulated with sequence words; see " { $link "quotations" } ". However, such runtime quotation manipulation will not be optimized by the optimizing compiler." ;
|
"Quotations also implement the sequence protocol, and can be manipulated with sequence words; see " { $link "quotations" } ". However, such runtime quotation manipulation will not be optimized by the optimizing compiler." ;
|
||||||
|
|
||||||
ARTICLE: "booleans" "Booleans"
|
ARTICLE: "booleans" "Booleans"
|
||||||
"In Factor, any object that is not " { $link f } " has a true value, and " { $link f } " has a false value. The " { $link t } " object is the canonical true value."
|
"In Factor, any object that is not " { $link postpone\ f } " has a true value, and " { $link postpone\ f } " has a false value. The " { $link t } " object is the canonical true value."
|
||||||
{ $subsections f t }
|
{ $subsections f t }
|
||||||
"A union class of the above:"
|
"A union class of the above:"
|
||||||
{ $subsections boolean }
|
{ $subsections boolean }
|
||||||
|
@ -133,25 +133,25 @@ ARTICLE: "booleans" "Booleans"
|
||||||
}
|
}
|
||||||
"Boolean values are most frequently used for " { $link "conditionals" } "."
|
"Boolean values are most frequently used for " { $link "conditionals" } "."
|
||||||
{ $heading "The f object and f class" }
|
{ $heading "The f object and f class" }
|
||||||
"The " { $link f } " object is the unique instance of the " { $link f } " class; the two are distinct objects. The latter is also a parsing word which adds the " { $link f } " object to the parse tree at parse time. To refer to the class itself you must use " { $link postpone\ postpone\ } " or " { $link postpone\ \ } " to prevent the parsing word from executing."
|
"The " { $link postpone\ f } " object is the unique instance of the " { $link postpone\ f } " class; the two are distinct objects. The latter is also a parsing word which adds the " { $link postpone\ f } " object to the parse tree at parse time. To refer to the class itself you must use " { $link \ postpone\ } " or " { $link \ \ } " to prevent the parsing word from executing."
|
||||||
$nl
|
$nl
|
||||||
"Here is the " { $link f } " object:"
|
"Here is the " { $link \ f } " object:"
|
||||||
{ $example "f ." "f" }
|
{ $example "f ." "f" }
|
||||||
"Here is the " { $link f } " class:"
|
"Here is the " { $link \ f } " class:"
|
||||||
{ $example "\\ f ." "postpone\ f" }
|
{ $example "\\ f ." "postpone\\ f" }
|
||||||
"They are not equal:"
|
"They are not equal:"
|
||||||
{ $example "f \\ f = ." "f" }
|
{ $example "f \\ f = ." "f" }
|
||||||
"Here is an array containing the " { $link f } " object:"
|
"Here is an array containing the " { $link \ f } " object:"
|
||||||
{ $example "{ f } ." "{ f }" }
|
{ $example "{ f } ." "{ f }" }
|
||||||
"Here is an array containing the " { $link f } " class:"
|
"Here is an array containing the " { $link \ f } " class:"
|
||||||
{ $example "{ postpone\ f } ." "{ postpone\ f }" }
|
{ $example "{ postpone\\ f } ." "{ postpone\\ f }" }
|
||||||
"The " { $link f } " object is an instance of the " { $link f } " class:"
|
"The " { $link postpone\ f } " object is an instance of the " { $link postpone\ f } " class:"
|
||||||
{ $example "USE: classes" "f class-of ." "postpone\ f" }
|
{ $example "USE: classes" "f class-of ." "postpone\\ f" }
|
||||||
"The " { $link f } " class is an instance of " { $link word } ":"
|
"The " { $link postpone\ f } " class is an instance of " { $link word } ":"
|
||||||
{ $example "USE: classes" "\\ f class-of ." "word" }
|
{ $example "USE: classes" "\\ f class-of ." "word" }
|
||||||
"On the other hand, " { $link t } " is just a word, and there is no class which it is a unique instance of."
|
"On the other hand, " { $link t } " is just a word, and there is no class which it is a unique instance of."
|
||||||
{ $example "t \\ t eq? ." "t" }
|
{ $example "t \\ t eq? ." "t" }
|
||||||
"Many words which search collections confuse the case of no element being present with an element being found equal to " { $link f } ". If this distinction is important, there is usually an alternative word which can be used; for example, compare " { $link at } " with " { $link at* } "." ;
|
"Many words which search collections confuse the case of no element being present with an element being found equal to " { $link postpone\ f } ". If this distinction is important, there is usually an alternative word which can be used; for example, compare " { $link at } " with " { $link at* } "." ;
|
||||||
|
|
||||||
ARTICLE: "conditionals-boolean-equivalence" "Expressing conditionals with boolean logic"
|
ARTICLE: "conditionals-boolean-equivalence" "Expressing conditionals with boolean logic"
|
||||||
"Certain simple conditional forms can be expressed in a simpler manner using boolean logic."
|
"Certain simple conditional forms can be expressed in a simpler manner using boolean logic."
|
||||||
|
|
|
@ -134,7 +134,7 @@ HELP: <clumps>
|
||||||
{ $example
|
{ $example
|
||||||
"USING: grouping sequences math prettyprint kernel ;"
|
"USING: grouping sequences math prettyprint kernel ;"
|
||||||
"IN: scratchpad"
|
"IN: scratchpad"
|
||||||
"CONSTANT: share-price { 13/50 51/100 13/50 1/10 4/5 17/20 33/50 3/25 19/100 3/100 }"
|
"CONSTANT: share-price { 13/50 51/100 13/50 1/10 4/5 17/20 33/50 3/25 19/100 3/100 } ;"
|
||||||
""
|
""
|
||||||
"share-price 4 <clumps> [ [ sum ] [ length ] bi / ] map ."
|
"share-price 4 <clumps> [ [ sum ] [ length ] bi / ] map ."
|
||||||
"{ 113/400 167/400 201/400 241/400 243/400 91/200 1/4 }"
|
"{ 113/400 167/400 201/400 241/400 243/400 91/200 1/4 }"
|
||||||
|
|
|
@ -638,7 +638,7 @@ $nl
|
||||||
" \"San Francisco\""
|
" \"San Francisco\""
|
||||||
" \"Los Angeles\""
|
" \"Los Angeles\""
|
||||||
" \"New York\""
|
" \"New York\""
|
||||||
"}"
|
"} ;"
|
||||||
""
|
""
|
||||||
": add-tax ( price city -- price' )"
|
": add-tax ( price city -- price' )"
|
||||||
" american-cities member? [ 1.1 * ] unless ;"
|
" american-cities member? [ 1.1 * ] unless ;"
|
||||||
|
|
|
@ -469,13 +469,13 @@ HELP: \ SINGLETONS:
|
||||||
{ $description "Creates a new singleton for every token until the " { $snippet ";" } "." } ;
|
{ $description "Creates a new singleton for every token until the " { $snippet ";" } "." } ;
|
||||||
|
|
||||||
HELP: \ ALIAS:
|
HELP: \ ALIAS:
|
||||||
{ $syntax "ALIAS: new-word existing-word" }
|
{ $syntax "ALIAS: new-word existing-word ;" }
|
||||||
{ $values { "new-word" word } { "existing-word" word } }
|
{ $values { "new-word" word } { "existing-word" word } }
|
||||||
{ $description "Creates a new inlined word that calls the existing word." }
|
{ $description "Creates a new inlined word that calls the existing word." }
|
||||||
{ $examples
|
{ $examples
|
||||||
{ $example "USING: prettyprint sequences ;"
|
{ $example "USING: prettyprint sequences ;"
|
||||||
"IN: alias.test"
|
"IN: alias.test"
|
||||||
"ALIAS: sequence-nth nth"
|
"ALIAS: sequence-nth nth ;"
|
||||||
"0 { 10 20 30 } sequence-nth ."
|
"0 { 10 20 30 } sequence-nth ."
|
||||||
"10"
|
"10"
|
||||||
}
|
}
|
||||||
|
@ -685,7 +685,7 @@ HELP: \ MATH:
|
||||||
{ $description "Defines a new generic word which uses the " { $link math-combination } " method combination." } ;
|
{ $description "Defines a new generic word which uses the " { $link math-combination } " method combination." } ;
|
||||||
|
|
||||||
HELP: \ HOOK:
|
HELP: \ HOOK:
|
||||||
{ $syntax "HOOK: word variable ( stack -- effect )" }
|
{ $syntax "HOOK: word variable ( stack -- effect ) ;" }
|
||||||
{ $values { "word" "a new word to define" } { "variable" word } }
|
{ $values { "word" "a new word to define" } { "variable" word } }
|
||||||
{ $description "Defines a new hook word in the current vocabulary. Hook words are generic words which dispatch on the value of a variable, so methods are defined with " { $link \ M: } ". Hook words differ from other generic words in that the dispatch value is removed from the stack before the chosen method is called." }
|
{ $description "Defines a new hook word in the current vocabulary. Hook words are generic words which dispatch on the value of a variable, so methods are defined with " { $link \ M: } ". Hook words differ from other generic words in that the dispatch value is removed from the stack before the chosen method is called." }
|
||||||
{ $examples
|
{ $examples
|
||||||
|
@ -695,7 +695,7 @@ HELP: \ HOOK:
|
||||||
"SYMBOL: transport"
|
"SYMBOL: transport"
|
||||||
"TUPLE: land-transport ;"
|
"TUPLE: land-transport ;"
|
||||||
"TUPLE: air-transport ;"
|
"TUPLE: air-transport ;"
|
||||||
"HOOK: deliver transport ( destination -- )"
|
"HOOK: deliver transport ( destination -- ) ;"
|
||||||
"M: land-transport deliver \"Land delivery to \" write print ;"
|
"M: land-transport deliver \"Land delivery to \" write print ;"
|
||||||
"M: air-transport deliver \"Air delivery to \" write print ;"
|
"M: air-transport deliver \"Air delivery to \" write print ;"
|
||||||
"T{ air-transport } transport set"
|
"T{ air-transport } transport set"
|
||||||
|
|
|
@ -62,8 +62,8 @@ HELP: translate-local-loc
|
||||||
{ $examples
|
{ $examples
|
||||||
{ $example
|
{ $example
|
||||||
"USING: compiler.cfg.stacks.local compiler.cfg.registers compiler.cfg.debugger namespaces prettyprint ;"
|
"USING: compiler.cfg.stacks.local compiler.cfg.registers compiler.cfg.debugger namespaces prettyprint ;"
|
||||||
"D: 7 { { 3 0 } { 0 0 } } translate-local-loc ."
|
"d: 7 { { 3 0 } { 0 0 } } translate-local-loc ."
|
||||||
"D: 4"
|
"d: 4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{ $see-also height-state } ;
|
{ $see-also height-state } ;
|
||||||
|
|
|
@ -23,9 +23,9 @@ HELP: vocab-files
|
||||||
$[
|
$[
|
||||||
{
|
{
|
||||||
"{"
|
"{"
|
||||||
" \"resource:core/alien/libraries/libraries.factor\""
|
" \"vocab:alien/libraries/libraries.factor\""
|
||||||
" \"resource:core/alien/libraries/libraries-docs.factor\""
|
" \"vocab:alien/libraries/libraries-docs.factor\""
|
||||||
" \"resource:core/alien/libraries/libraries-tests.factor\""
|
" \"vocab:alien/libraries/libraries-tests.factor\""
|
||||||
"}"
|
"}"
|
||||||
} "\n" join
|
} "\n" join
|
||||||
]
|
]
|
||||||
|
@ -42,15 +42,15 @@ HELP: vocab-tests
|
||||||
$[
|
$[
|
||||||
{
|
{
|
||||||
"{"
|
"{"
|
||||||
" \"resource:basis/xml/tests/cdata.factor\""
|
" \"vocab:xml/tests/cdata.factor\""
|
||||||
" \"resource:basis/xml/tests/encodings.factor\""
|
" \"vocab:xml/tests/encodings.factor\""
|
||||||
" \"resource:basis/xml/tests/funny-dtd.factor\""
|
" \"vocab:xml/tests/funny-dtd.factor\""
|
||||||
" \"resource:basis/xml/tests/soap.factor\""
|
" \"vocab:xml/tests/soap.factor\""
|
||||||
" \"resource:basis/xml/tests/state-parser-tests.factor\""
|
" \"vocab:xml/tests/state-parser-tests.factor\""
|
||||||
" \"resource:basis/xml/tests/templating.factor\""
|
" \"vocab:xml/tests/templating.factor\""
|
||||||
" \"resource:basis/xml/tests/test.factor\""
|
" \"vocab:xml/tests/test.factor\""
|
||||||
" \"resource:basis/xml/tests/xmltest.factor\""
|
" \"vocab:xml/tests/xmltest.factor\""
|
||||||
" \"resource:basis/xml/tests/xmode-dtd.factor\""
|
" \"vocab:xml/tests/xmode-dtd.factor\""
|
||||||
"}"
|
"}"
|
||||||
} "\n" join
|
} "\n" join
|
||||||
]
|
]
|
||||||
|
|
|
@ -136,7 +136,7 @@ HELP: symbols>flags
|
||||||
" { resize-handles 8 }"
|
" { resize-handles 8 }"
|
||||||
" { small-title-bar 16 }"
|
" { small-title-bar 16 }"
|
||||||
" { normal-title-bar 32 }"
|
" { normal-title-bar 32 }"
|
||||||
"}"
|
"} ;"
|
||||||
"{ resize-handles close-button small-title-bar } window-controls>flags symbols>flags ."
|
"{ resize-handles close-button small-title-bar } window-controls>flags symbols>flags ."
|
||||||
"25"
|
"25"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue