in reply to Re: No Iterators Allowed
in thread No Iterators Allowed

Yeah, I know I could have implemented real linked lists, but I just wanted to keep things simple, and also, it would make the initialization of the passed in lists messier looking :-)

But it would be nice if you could make it O(1) anyway without linked lists.

Replies are listed 'Best First'.
Re^3: No Iterators Allowed
by Joost (Canon) on Feb 28, 2008 at 00:16 UTC
    But it would be nice if you could make it O(1) anyway without linked lists.
    You could implement cdr as returning a shared hash slice. With some XS hacking you can probably make it work for some cases. Though you may have to make arrays immutable to do it right :-)

    update: it seems to me you could implement this in pure perl using tied arrays. But it would get more inefficient for each slice-of-a-slice-of-a-slice.