+! See http://factorcode.org/license.txt for BSD license.
+USING: help.markup help.syntax kernel quotations math sequences
+multiline ;
+IN: combinators.smart
+
+HELP: input<sequence
+{ $values
+ { "quot" quotation }
+ { "newquot" quotation }
+}
+{ $description "Infers the number of inputs, " { $snippet "n" } ", to " { $snippet "quot" } " and calls the " { $snippet "quot" } " with the first " { $snippet "n" } " values from a sequence." }
+{ $examples
+ { $example
+ "USING: combinators.smart math prettyprint ;"
+ "{ 1 2 3 } [ + + ] input<sequence ."
+ "6"
+ }
+} ;
+
+HELP: output>array
+{ $values
+ { "quot" quotation }
+ { "newquot" quotation }
+}
+{ $description "Infers the number or outputs from the quotation and constructs an array from those outputs." }
+{ $examples
+ { $example
+ <" USING: combinators combinators.smart math prettyprint ;
+{ $description "Infers the number of outputs from " { $snippet "quot" } " and reduces them using " { $snippet "operation" } ". The identity for the " { $link reduce } " operation is the first output." }
+{ $examples
+ { $example
+ "USING: combinators.smart kernel math prettyprint ;"
+{ $description "Infers the number of outputs from " { $snippet "quot" } " and returns their sum." }
+{ $examples
+ { $example
+ "USING: combinators.smart kernel math prettyprint ;"
+ "10 [ [ 1- ] [ 1+ ] bi ] sum-outputs ."
+ "20"
+ }
+} ;
+
+ARTICLE: "combinators.smart" "Smart combinators"
+"The " { $vocab-link "combinators.smart" } " vocabulary implements " { $emphasis "smart combinators" } ". A smart combinator is one whose behavior depends on the static stack effect of an input quotation." $nl
-"There are analogous routines which operate on individual code points, but these should " { $emphasis "not be used" } " in general as they have slightly different behavior. In some cases, for example, they do not perform the case operation, as a single code point must expand to more than one."