
=pod

=head1 NAME

Notes on Range implementation

=head1 SYNOPSIS

A Range is a lazy iterator with a starting, iterating, and stopping condition. 

=head1 DESCRIPTION

The Range API will be specified using a role, but there will be a number of 
class implementations which do that role. 

There are basic "front-end" range classes, which are:

=over 4

=item NumRange

The classic numeric range, C<1 .. 10> and all that it implies.

=item StrRange

The range of strings, C<a .. z>. Probably pretty obvious, but might be a little 
trickier in the presence of unicode. We will see.

=item RepeatRange

A range of repeated things, C<1 xx 10>. This is useful for initializing
data structures:

    @a[0..999] = -1 xx 1000;

=back

The other classes will be private or inner classes to the "front-end" 
Range clases, and those are:

=over 4

=item MapRange

When the C<map(CODE)> method is called on a Range object, we need to preserve the 
original Range, and only apply the CODE object to each element B<after> it has 
been generated. This could probably be accomplished with some closure acrobatics, 
but a seperate classe helps to preserve KISS :)

=item GrepRange

The same logic and reasoning which applies to MapRange, applies here.

=item ReverseRange

This may not be needed, it may be easy enough to just swap the start condition, for 
the end condition, but we will see.

=back

=head1 LARRY SAYS

If you say

    $r = 1..10;

you are intentionally putting the range object in a place where you
have to explicitly iterate it, so in list context you'd have to say

    for =$r { say }

=head1 SEE ALSO 

docs/notes/laziness.txt 

perl5/Perl6-(Value|Container)

=head1 AUTHOR

Stevan Little <stevan@iinteractive.com>

=cut
