e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B
RubyConfe$B$G;~4V$,6u$$$?$N$G8E$$%a!<%k$rH/7!$7$^$7$?!#e(B
In message “Re: [ruby-dev:29246] Enumerable#each_* and Enumerable#enum_*
on 1.9”
on Wed, 9 Aug 2006 23:07:12 +0900, “U.Nakamura”
[email protected] writes:
|e$B$A$g$C$He(B1.9e$B$Ne(BEnumerablee$B$GM7$s$G$$$F5$IU$$$?$N$G$9$,!"e(B1.9e$B$G$Oe(B
|e$B%V%m%C%/$rH<$o$J$$%$%F%l!<%?8F$S=P$7%a%=%C%I8F$S=P$7e(B(e$B2?$r8@$Ce(B
|e$B$F$k$N$+$o$+$s$J$$e(B)e$B$Oe(BEnumerable::Enumeratore$B%*%V%8%'%/%H$rJV$9e(B
|e$B$N$K!“85!9e(Benumerator.soe$B$K$”$C$?%$%F%l!<%?8F$S=P$7%a%=%C%I$O$=e(B
|e$B$&$J$C$F$$$^$;$s!#e(B
e$B$*$C$7$c$k$h$&$Ke(BEnumeratore$B$N%a%=%C%I$,%V%m%C%/$J$7$G8F$P$l$ke(B
e$B$He(BEnumerable::Enumeratore$B$rJV$9$o$1$G$9$,!"$3$l$O$I$&$7$F$=$&e(B
e$B$J$C$F$k$s$G$7$g$&$+$M!#$=$s$J$K$&$l$7$$6ILL$,;W$$$D$-$^$;$s!#e(B
e$BF3F~$5$l$?$N$Oe(B
Fri Jul 15 00:11:36 2005 Nobuyoshi N. [email protected]
* enum.c (enumeratorize): create new enumerator for current method if
no block is given.
* enumerator.c: moved from ext/enumerator.
e$B$J$s$G$9$,!“M}M3$,;W$$=P$;$^$;$s!#9b662qD9$O!”;d$,8@$$=P$7$?e(B
e$B$N$G$O$J$$$+$H$N$3$H$G$9$,!#$"$-$l$k5-21NO$G$9$M!#e(B
e$B$^$“!”;d$N5-21NO$,%@%a$J$N$O@N$+$i$J$N$G$A$g$C$HCV$$$F$*$/$He(B
e$B$7$F$b!“$3$N$3$H$r5v$9$3$H$G$-$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