Or tacitly foldr=: (~/)(@|.)
- foldr i.5 _10 foldr (~/)(@|.) -foldr -~/@|. The initial accumulator is superflous in J, which knows the identity elements of verbs. --- Devon McCormick <[EMAIL PROTECTED]> wrote: > Maybe along these lines? > > -/i.5 NB. Right fold > 2 > (((0-1)-2)-3)-4 NB. Left fold > _10 > (-~)/|.i.5 > _10 > > ((((0-1)-2)-3)-4)-5 > _15 > (-~)/|.i.6 > _15 > > %/>:i.5 NB. Right fold > 1.875 > (%~)/|.>:i.5 NB. Left fold > 0.0083333333 > (((1%2)%3)%4)%5 > 0.0083333333 > > > > On 11/16/07, metaperl.j <[EMAIL PROTECTED]> wrote: > > > > > > Folding and unfolding are staples of functional programming. Insert > > approximates fold-left, but what approximates fold-right? > > > > -- > > View this message in context: > > http://www.nabble.com/Where-is-right-fold-in-J--tf4824111s24193.html#a13802283 > > Sent from the J General mailing list archive at Nabble.com. > > > > ---------------------------------------------------------------------- > > For information about J forums see http://www.jsoftware.com/forums.htm > > > > > > -- > Devon McCormick, CFA > ^me^ at acm. > org is my > preferred e-mail > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > ____________________________________________________________________________________ Be a better sports nut! Let your teams follow you with Yahoo Mobile. Try it now. http://mobile.yahoo.com/sports;_ylt=At9_qDKvtAbMuh1G1SQtBI7ntAcJ ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
