From: Akinori MUSHA Date: 2001-05-21T14:24:53+09:00 Subject: [ruby-dev:13265] Re: Enumerator -- Round 2 At Mon, 21 May 2001 06:04:32 +0900, matz wrote: > | Enumerable#enum_with(method, *args) > > enum_by$B$H$+(Benum_using$B$H$+$b$"$j$($^$9$M!#(B $B!!$J$k$[$I!#2<$N(B with_index $B$H(B with $B$,$+$V$j$^$9$+$i$M!#(B > | Enumerable#with_index() > > with_index$B$r(BEnumerable$B$KIU$1$k$N$K$O$J$K$+0cOB46$,$"$j$^$9!#(B > $B$H$$$&$N$b(B with_index $B$H$$$&L>A0$K$O!V7+$jJV$7!W$r0UL#$9$kIt(B > $BJ,$,$J$$$+$i$G$9!#5!G=$G$J$/L>A0$NLdBj$G$9$M!#(B > enum_with_index? $B!!3N$+$K$=$&$G$9$M!#(BEnumerator $B$r:n$C$FJV$9$H$$$&E@$G!">e$N(B enum_with $B$HF1Ns$G$9$7!#(B > | Enumerable#in_groups_of(n) > > $B$3$l$b(Bwith_index$B$H$[$\F1MM$NM}M3$GJL$NL>A0$r4uK>$7$^$9!#(B $B!!0J>e$N;0$D$r(B enum_with -> enum_using with_index -> enum_indexed in_groups_of -> enum_sliced $B$H$7$?$iE}0l46$,=P$k$G$7$g$&$+!#C1J#$r9M$($?$/$J$$$N$GJ,;l$K(B $BE}0l$7$F$_$^$7$?!#(B(slice $B$K$D$$$F$O2<=R(B) > | Enumerable#each_group_of(n) { |ary| ... } > | $BMWAG$r(B n $B8D$:$D > $B$3$l$K$O;?@.!#(B $B!!9M$($F$_$?$s$G$9$,!"(B group $B$@$H$I$&%0%k!<%T%s%0$9$k$N$+[#Kf(B $B$J$N$G!"(B Array#slice $B$+$i$NN`?d$G(B slice $B$H$$$&8@MU$r;H$&$N$O(B $B$I$&$G$7$g$&$+!#(B($B0lEYH]DjE*$J$3$H$r8@$C$?$/$;$K!#!#(B) $B!!$D$^$j(B each_slice(n) { |ary| ... } .AN$NGN$N9N!N#group $B$@$H!">r7o$r=q$/$N$G$O$J$/$$$/$D$+$4$H$KJ,$1$k$N$@(B $B$H$$$&%K%e%"%s%9$r=P$9$?$a$K(B of $B$,I,MW$H46$8$?$N$G$9$,!"(B slice $B$J$i?t$r | Enumerator[obj, method = :each, *args] > | Enumerator::new(obj, method = :each, *args) > > $B4J7i$JI=5-$K$7$?$$F05!$OJ,$+$k$s$G$9$,!"$3$3$G$N(B [] $B$NMxMQ$K(B > $B$O;?@.$7$^$;$s!#(Bnew$B$OLdBj$J$7!#(B $B!!(B[] $B$NMxMQ$K$D$$$F$N:#8e$N;X?K$,M_$7$$$+$b!#(B $B!!$=$m$=$m8uJd$r7G$2$F(B ruby-talk $B$K?6$j$?$$$H;W$$$^$9$,!"2?$+(B $BB>$KDs0F$O$"$j$^$9$G$7$g$&$+!)(B -- / /__ __ Akinori.org / MUSHA.org / ) ) ) ) / FreeBSD.org / Ruby-lang.org Akinori MUSHA aka / (_ / ( (__( @ iDaemons.org / and.or.jp "Freeze this moment a little bit longer, make each impression a little bit stronger.. Experience slips away -- Time stand still"