On Thu, 4 Mar 2004, Flavio S. Glock wrote:
> Looks good. How about:
>
> * set_map
>
> $set2 = $set->set_map( sub { return } );
> # same as $set->clone
This would be the same as $set->empty_set, actally.
Clone would be:
$set2 = $set->set-Map( sub { return $_[0]->clone } );
> $set2 = $set->set_map( sub {
> $_[0]->add( hours => 1 );
> return;
> }
> );
> # same as before.
Hmm, this does encourage the "map in void context" idiom, which is
unfortunate. In this case, $set2 would be an empty set. Maybe we should
leave iterate() in as well, since map in a void context is discouraged in
Perl.
> * set_grep
>
> $set2 = $set->set_grep( sub { 1 } );
> # same as $set->clone
>
> $set2 = $set->set_grep( sub { return } );
> # make an empty set
>
> $set2 = $set->set_grep( sub { $_[0]->day > 15 } );
> # makes a new set, all set elements have day > 15
Yup.
-dave
/*=======================
House Absolute Consulting
www.houseabsolute.com
=======================*/