sequences: change stack effect docs for map-reduce to be more consistent.
parent
225e87339b
commit
608bedd208
|
@ -1344,7 +1344,7 @@ HELP: insert-nth
|
||||||
|
|
||||||
HELP: map-reduce
|
HELP: map-reduce
|
||||||
{ $values
|
{ $values
|
||||||
{ "seq" sequence } { "map-quot" { $quotation "( ..a x -- ..b elt )" } } { "reduce-quot" { $quotation "( ..b prev elt -- ..a next )" } }
|
{ "seq" sequence } { "map-quot" { $quotation "( ..a elt -- ..b intermediate )" } } { "reduce-quot" { $quotation "( ..b prev intermediate -- ..a next )" } }
|
||||||
{ "result" object } }
|
{ "result" object } }
|
||||||
{ $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." }
|
{ $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." }
|
{ $errors "Throws an error if the sequence is empty." }
|
||||||
|
|
|
@ -924,7 +924,7 @@ PRIVATE>
|
||||||
: unclip-slice ( seq -- rest-slice first )
|
: unclip-slice ( seq -- rest-slice first )
|
||||||
[ rest-slice ] [ first-unsafe ] bi ; inline
|
[ rest-slice ] [ first-unsafe ] bi ; inline
|
||||||
|
|
||||||
: map-reduce ( ..a seq map-quot: ( ..a x -- ..b elt ) reduce-quot: ( ..b prev elt -- ..a next ) -- ..a result )
|
: map-reduce ( ..a seq map-quot: ( ..a elt -- ..b intermediate ) reduce-quot: ( ..b prev intermediate -- ..a next ) -- ..a result )
|
||||||
[ [ dup first ] dip [ call ] keep ] dip compose
|
[ [ dup first ] dip [ call ] keep ] dip compose
|
||||||
swapd [ 1 ] 2dip (each) (each-integer) ; inline
|
swapd [ 1 ] 2dip (each) (each-integer) ; inline
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue