Anyone want to pick up this? I just don't have the time, but I would like to
see it in Perl6.
=========================

=head1 TITLE

Builtin list context lindex() function

=head1 VERSION

  Maintainer: NA <[EMAIL PROTECTED]>
  Date: 09 SEP 2000
  Version: 0
  Mailing List: perl6-language
  Number: 1

=head1 ABSTRACT

Offer a simpler way to iterate through a list/array for matching
purposes by adding the function C<lindex>.

=head1 DESCRIPTION

RFCs 207 and 262 offer suggestions regarding loop iterators and
array indices, but still require a loop to parse through the
entries of the list. This RFC proposes a C<lindex> function for
finding list entries that match the expression. The builtin
would return the index of the list entry that matched the
expression passed.

=head1 IMPLEMENTATION

I can think of two options for implementation:

=head2 Similar to C<index>

C<list_index = lindex @list, EXPR, [offset]>.

=head2 Similar to C<substr>

C<list_index = lindex @list, EXPR, [offset, replacement]

In both cases, C<offset> should be I<null> of I<undef> for
subsequent calls to the function if an incremental search is
desired. The function should also return I<undef> for a null
list or if the end-of-list is reached. A negative number
passed to offset, could also indicate a reverse search, or
a starting-point from the end-of-list.

=head1 REFERENCES



Reply via email to