develooper Front page | perl.perl6.language | Postings from March 2005

Re: Referencing a caller's slurpy array.

Thread Previous | Thread Next
From:
Rod Adams
Date:
March 16, 2005 21:49
Subject:
Re: Referencing a caller's slurpy array.
Message ID:
42391A58.4030701@rodadams.net
Luke Palmer wrote:

>Rod Adams writes:
>  
>
>>In S29, I currently have C<grep> as:
>>
>>multi sub grep (Any|Junction $test : *@values) returns List {
>>  gather {
>>    for @values -> $x {
>>      take $x if $x ~~ $test;
>>    }
>>  }
>>}
>>    
>>
>
>That's the listop form.  I was referring to the method form:
>
>    multi sub grep (@array: *&code) returns List {
>        ...
>    }
>  
>
Got it. I'll be adding that form to various functions shortly.

Could I please get a list of what forms I need to be defining in S29?

Right now I have:
- General non-OO form.
- adverbial code block form (where applicable).


I haven't gotten a solid answer on when and how Perl will autogenerate 
methods from subs. 

For instance, would

  @array.grep(/foo/);

generate a call to the list op C<grep> above, or do I need to be 
defining another form of C<grep> that's more agreeable to 
autogeneration? If so, what makes a sub more agreeable to auto method 
generation?

-- Rod Adams

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About