From: miles@... (Miles Egan) Date: 2001-10-16T04:04:57+09:00 Subject: [ruby-talk:22584] Re: Array.filter On Tue, 16 Oct 2001 02:50:35 +0900, Jimmy Thrasher wrote: >Miles, > >> Where is the nondestructive Array.filter? I know that the old >Array.filter has >> been deprecated but I don't see a function that gives me this: >> >> a = [1, 2, 3, 4] >> b = a.filter { |i| i % 2 = 0 } >> >> leaving a = [1, 2, 3, 4] and b = [2, 4]. > >Try Array#select. > >irb(main):001:0> a = [1,2,3,4] >[1, 2, 3, 4] >irb(main):002:0> b = a.select { |i| i % 2 == 0 } >[2, 4] > >Jimmy Excellent. Thanks for your help. This isn't in the docs, so I missed it. -- miles egan