From: matz@... (Yukihiro Matsumoto) Date: 2000-04-12T01:21:15+09:00 Subject: [ruby-talk:02451] Re: Iterator into array Hi, In message "[ruby-talk:02450] Re: Iterator into array" on 00/04/11, Dave Thomas writes: |This is another dumb idea, but... | |Say we allowed the syntax | | method1(args) method2(args) | |method2 would have to return a proc object. | |Then we could do something like | | def into(anArray) | proc { |i| anArray << i } | end | | | (1..10).each into(a = []) | |Ideally I'd like the whole expression to return the array, but I can't |see a tidy way to do that. It's exactly what block argument does, I think. (1..10).each(&into(a = [])) p a # [1,2,3,4,5,6,7,8,9,10] matz.