Re: proposed RFC. lindex() function...

2000-09-26 Thread Webmaster

Dear Iain,
I had a few moments, so I tried to put together a subroutine that would
express what I was thinking. It's attached with the script that I used to
test it.
Grant M.
[EMAIL PROTECTED]


 lndxexmp.pl
 lindex.pl


proposed RFC. lindex() function...

2000-09-25 Thread Webmaster

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 Clindex.

=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 Clindex 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 Cindex

Clist_index = lindex @list, EXPR, [offset].

=head2 Similar to Csubstr

Clist_index = lindex @list, EXPR, [offset, replacement]

In both cases, Coffset should be Inull of Iundef for
subsequent calls to the function if an incremental search is
desired. The function should also return Iundef 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