[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [FWP] [ruby-talk:4931] Re: Perl 6 rumblings -- RFC 225 (v1) Data: Superpositions (fwd)



John Carter wrote:
> 
> Someone took the Perl 6 RFC 225 Data Superpositions paper and sent it to
> ruby talk.
> 
> Matz the author of ruby promptly demonstrated the power and cleanness of
> the Ruby iterators.


Looks magical if you don't know what the ruby code there is actually doing.

The equivalent perl could be written like this:

      sub any(&@) {
        my $c = shift;
        for ( @_ ) { return 1 if $c->($_) }
        0
      }

      sub all(&@) {
        my $c = shift;
        for ( @_ ) { return 0 unless $c->($_) }
        1
      }
  
    if ( all { $_ < 10 } @x ) {
      ...
    }

The equivalent Lisp/Scheme/Dylan/ML/Haskell code is equivalently trivial.
  
Ruby: Big Frqkin Deal.

-- 
John Porter


==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe