Gregor N. Purdy writes:
: I think of slicing as a shortcut for map.
: 
:    foo[1,2,3]   ===    map { foo[$_] } (1,2,3)
: 
: I think of multidimensionality as arrays-of-arrays:
: 
:    foo[1][2]
: 
: As for combining the two, I guess that would be
: 
:    foo[1,2][3,4]  =~=  temp = map { foo[$_] } (1,2);
:                        map { temp[$_] } (3,4)

I think the math folks want to write that:

    foo[1,2;3,4]

And I don't see why we can't support that.  As I said somewhere, that's
probably just shorthand for

    foo[[1,2],[3,4]]

So I guess that's actually the "leaf" view of the extra dimension.

: I think of ranges as being lazy lists. Under flattening, they
: remain generators and cause the the flattened list to also be lazy
: so that when the ranges are encountered they DTRT. Optimization
: might cause short ranges to explode so we don't have too much
: time overhead for (1..5), while still avoiding space overhead for
: (1...1000000).

Yes, ranges are just one kind of generator.  Any generator turns a
list into a lazy list.  In fact, most lists will be lazy under the
hood, I expect.  Consider something like this:

    @lines = <$in>;
    print @lines;

That may well be doing the actual input during the print.  On the other
hand, if you take the length of the array, it'd have to slurp it all
in right then and there.

Larry

Reply via email to