]> gitweb.factorcode.org Git - factor.git/commitdiff
touch up quotation documentation
authorJoe Groff <arcata@gmail.com>
Sat, 31 Oct 2009 21:40:10 +0000 (16:40 -0500)
committerJoe Groff <arcata@gmail.com>
Sat, 31 Oct 2009 21:40:10 +0000 (16:40 -0500)
core/quotations/quotations-docs.factor
core/syntax/syntax-docs.factor

index 983ddbaf9ad3e7b8297c0f1844d326210ee4acbb..b6be8d36f33c731c5747a2f4028f555fd0778d1e 100644 (file)
@@ -3,29 +3,28 @@ vectors kernel combinators ;
 IN: quotations
 
 ARTICLE: "quotations" "Quotations"
-"Conceptually, a quotation is an anonymous function (a value denoting a snippet of code) which can be passed around and called."
+"A quotation is an anonymous function (a value denoting a snippet of code) which can be used as a value and called. Quotations are delimited by square brackets (" { $snippet "[ ]" } "); see " { $link "syntax-quots" } " for details on their syntax."
 $nl
-"Concretely, a quotation is an immutable sequence of objects, some of which may be words, together with a block of machine code which may be executed to achieve the effect of evaluating the quotation. The machine code is generated by a fast non-optimizing quotation compiler which is always running and is transparent to the developer."
-$nl
-"Quotations form a class of objects, however in most cases, methods should dispatch on " { $link callable } " instead, so that " { $link curry } " and " { $link compose } " values can participate."
+"Quotations form a class of objects:"
 { $subsections
     quotation
     quotation?
 }
-"Quotations evaluate sequentially from beginning to end. Literals are pushed on the stack and words are executed. Details can be found in " { $link "evaluator" } "."
-$nl
-"Quotation literal syntax is documented in " { $link "syntax-quots" } "."
-$nl
+"A more general class is provided for methods to dispatch on that includes quotations, " { $link curry } ", and " { $link compose } " objects:"
+{ $subsections
+    callable
+}
+"Quotations evaluate sequentially from beginning to end. Literals are pushed on the stack and words are executed. Details can be found in " { $link "evaluator" } ". Words can be placed in wrappers to suppress execution:"
+{ $subsections "wrappers" }
 "Quotations implement the " { $link "sequence-protocol" } ", and existing sequences can be converted into quotations:"
 { $subsections
     >quotation
     1quotation
 }
-"Wrappers:"
-{ $subsections "wrappers" } ;
+"Although quotations can be treated as sequences, the compiler will be unable to reason about quotations manipulated as sequences at runtime. " { $link "compositional-combinators" } " are provided for runtime partial application and composition of quotations." ;
 
 ARTICLE: "wrappers" "Wrappers"
-"Wrappers are used to push words on the data stack; they evaluate to the object being wrapped:"
+"Wrappers evaluate to the object being wrapped when encountered in code. They are are used to suppress the execution of " { $link "words" } " so that they can be used as values."
 { $subsections
     wrapper
     literalize
index 2a8bf53e64bfbf23e092d08d3ddbf827a6513f67..e0b6c1acb9afc4ab53597bb11fb8cddc7d1864eb 100644 (file)
@@ -106,7 +106,7 @@ ARTICLE: "syntax-numbers" "Number syntax"
 } ;
 
 ARTICLE: "syntax-words" "Word syntax"
-"A word occurring inside a quotation is executed when the quotation is called. Sometimes a word needs to be pushed on the data stack instead. The canonical use-case for this is passing the word to the " { $link execute } " combinator, or alternatively, reflectively accessing word properties (" { $link "word-props" } ")."
+"A word occurring inside a quotation is executed when the quotation is called. Sometimes a word needs to be pushed on the data stack instead. The canonical use case for this is passing the word to the " { $link execute } " combinator, or alternatively, reflectively accessing word properties (" { $link "word-props" } ")."
 { $subsections
     POSTPONE: \
     POSTPONE: POSTPONE: