]> gitweb.factorcode.org Git - factor.git/blob - basis/combinators/short-circuit/smart/smart-docs.factor
Merge branch 'klazuka'
[factor.git] / basis / combinators / short-circuit / smart / smart-docs.factor
1 ! Copyright (C) 2008 Doug Coleman.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: help.markup help.syntax io.streams.string quotations ;
4 IN: combinators.short-circuit.smart
5
6 HELP: &&
7 { $values
8      { "quots" "a sequence of quotations" }
9      { "quot" quotation } }
10 { $description "Infers the number of arguments that each quotation takes from the stack. Eacn quotation must take the same number of arguments. Returns true if every quotation yields true, and stops early if one yields false." }
11 { $examples "Smart combinators will infer the two inputs:"
12     { $example "USING: prettyprint kernel math combinators.short-circuit.smart ;"
13     "2 3 { [ + 5 = ] [ - -1 = ] } && ."
14     "t"
15     }
16 } ;
17
18 HELP: ||
19 { $values
20      { "quots" "a sequence of quotations" }
21      { "quot" quotation } }
22 { $description "Infers the number of arguments that each quotation takes from the stack. Eacn quotation must take the same number of arguments. Returns true if any quotation yields true, and stops early when one yields true." }
23 { $examples "Smart combinators will infer the two inputs:"
24     { $example "USING: prettyprint kernel math combinators.short-circuit.smart ;"
25     "2 3 { [ - 1 = ] [ + 5 = ] } || ."
26     "t"
27     }
28 } ;
29
30 ARTICLE: "combinators.short-circuit.smart" "Smart short-circuit combinators"
31 "The " { $vocab-link "combinators.short-circuit.smart" } " vocabulary is similar to " { $vocab-link "combinators.short-circuit" } " except the combinators here infer the number of inputs that the sequence of quotations takes."
32 $nl
33 "Generalized AND:"
34 { $subsections && }
35 "Generalized OR:"
36 { $subsections || } ;
37
38 ABOUT: "combinators.short-circuit.smart"