]> gitweb.factorcode.org Git - factor.git/commitdiff
sequences: fix map-reduce and 2map-reduce docs, reported by Ben Schlingelhof
authorSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Sat, 12 Dec 2009 20:16:11 +0000 (15:16 -0500)
committerSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Sat, 12 Dec 2009 20:16:11 +0000 (15:16 -0500)
core/sequences/sequences-docs.factor

index 1e966c143d3901406b2dac40cba4f3c389876da8..aeab243a2f60adf3cb7c0145aa7e6e09a2e44381 100644 (file)
@@ -1191,7 +1191,8 @@ HELP: 2map-reduce
 { $values
      { "seq1" sequence } { "seq2" sequence } { "map-quot" quotation } { "reduce-quot" quotation }
      { "result" object } }
-{ $description "Unclips the first element of each sequence and calls " { $snippet "map-quot" } " on both objects. The result of this calculation is passed, along with the rest of both sequences, to " { $link 2reduce } ", with the computed object as the identity." }
+ { $description "Calls " { $snippet "map-quot" } " on each pair of elements from " { $snippet "seq1" } " and " { $snippet "seq2" } " and combines the results using " { $snippet "reduce-quot" } " in the same manner as " { $link reduce } ", except that there is no identity element, and the sequence must have a length of at least 1." }
+{ $errors "Throws an error if the sequence is empty." }
 { $examples { $example "USING: sequences prettyprint math ;"
     "{ 10 30 50 } { 200 400 600 } [ + ] [ + ] 2map-reduce ."
     "1290"
@@ -1289,7 +1290,8 @@ HELP: map-reduce
 { $values
      { "seq" sequence } { "map-quot" quotation } { "reduce-quot" quotation }
      { "result" object } }
-{ $description "Unclips the first element of the sequence, calls " { $snippet "map-quot" } " on that element, and proceeds like a " { $link reduce } ", where the calculated element is the identity element and the rest of the sequence is the sequence to reduce." }
+{ $description "Calls " { $snippet "map-quot" } " on each element and combines the results using " { $snippet "reduce-quot" } " in the same manner as " { $link reduce } ", except that there is no identity element, and the sequence must have a length of at least 1." }
+{ $errors "Throws an error if the sequence is empty." }
 { $examples { $example "USING: sequences prettyprint math ;"
     "{ 1 3 5 } [ sq ] [ + ] map-reduce ."
     "35"