LazySequence: Manages individual lazy sequences like 1..Inf (or
even 1..100_000)
LazyArray: Aggregates multiple lazy things together, along
with an "exceptions list" for things like:
@a = 1..Inf;
@a[6] = 42;
First, do these work well as pmcs, or should it be integrated with
PerlArray (I hope not)? Should Infinity be a pmc?
Any ideas on how these things should be set up at the assembly level?
I was thinking either:
$P0 = new LazySequence
$P1 = new Infinity
$P0["from"] = 0
$P0["to"] = $P1
or
$P0 = new LazySequence
$P1 = new Infinity
find_method P0, "set_range"
.arg 0 # Assuming imcc knows the new conventions
.arg $P1
invokecc
Finally, what should things like:
set $I0, $P0 # $P0 contains 1..Inf
Because integer registers can't well store infinity...
Thanks,
Luke
This would probably have the same effect as:
$P1 = new Infinity
set $I0, $P1
Now, what *that* would do, I dunno... :)
Actually, I sortof do -- it should throw an exception of some sort.
--
$a=24;split//,240513;s/\B/ => /for@@=qw(ac ab bc ba cb ca
);{push(@b,$a),($a-=6)^=1 for 2..$a/6x--$|;print "$@[$a%6
]\n";((6<=($a-=6))?$a+=$_[$a%6]-$a%6:($a=pop @b))&&redo;}
> First, do these work well as pmcs, or should it be integrated with
> PerlArray (I hope not)?
It should subclass PerlArray. I think you don't need LazySequence. You
can just set the exceptions to the lazy sequence in the PerlArray
subclass.
Array/PerlArray can hold values for e.g.:
@a[0..1000, 1_000_000_000..1_000_001_000]
without growing to 1e9*x bytes.
> Should Infinity be a pmc?
Probably yes.
> Any ideas on how these things should be set up at the assembly level?
> I was thinking either:
Have a look at the initializer in list.c:list_new_init() or
classes/array.c:init_pmc() and the docs of init_pmc in pdd02.
> Finally, what should things like:
> set $I0, $P0 # $P0 contains 1..Inf
> Because integer registers can't well store infinity...
Through an exception.
> Thanks,
> Luke
leo