From: Conrad Schneiker Date: 2000-09-16T13:10:02+09:00 Subject: [ruby-talk:4932] Re: Perl 6 rumblings -- RFC 225 (v1) Data: Superpositions Hi, "Yukihiro Matsumoto" wrote in message news:E13a0Mw-0005HW-00@ev.netlab.zetabits.co.jp... > Hi, > > In message "[ruby-talk:4930] Perl 6 rumblings -- RFC 225 (v1) Data: Superpositions" > on 00/09/16, Conrad Schneiker writes: > > |> if (any(@value) < 10) { ... } > |> > |> or: > |> > |> die unless all(@tests)->($data); > |> > |> ought to be available to all Perl users. > > This can be easily accomplished by the method like > > module Enumerable > def any > self.each do |item| > return true if yield(item) > end > return false > end > def all > self.each do |item| > return false unless yield(item) > end > return true > end > end > > if tests.all{|x| x < 10} then > ... > end > > Pretty easy huh? Very nice. Are we going to see this in 1.8? :-)