Do so and it might be added to Pike. Some more container types in Pike wouldn't be such a bad thing. The main issue is that these classes wouldn't be as easy to handle as the builtins from say Pike modules written in C, not to mention usage in "standard" methods (search / has_value for example).
Unless, of course, they are generalized like STL and Java (in that they don't require specific types, just specific characteristics such as "random seekable", "iterable" and such).
/ David Hedbor
Previous text:
2003-01-30 03:25: Subject: Re: hybrid of array & list
On Thu, Jan 30, 2003 at 02:05:03AM +0100, Martin Stjernholm, Roxen IS @ Pike developers forum wrote:
You mean: "ADT.Queue is using arrays to implement queues anyway, so I'll fix a better implementation." ;)
Well, I am slowly thinking about some hybride between lists and arrays, so I can use list->next(item)/list->prev(item) and indexes as well.
Actually, I need data type which will allow push/pop/shift (both FIFO & LIFO), destructive modification (by object reference, by index or index range) and access to the data by index. This data type should be quick enough when pushing/popping/shifting or iterating, and it should be possible to get an item which is next/previous to the specified.
Methods that I want at least (I hope purpose is obvious):
mixed push(mixed item, mixed|int|void pos) mixed pop(int|void count, int|void pos) mixed peek(int|void pos) void delete(mixed|int start, mixed|int|void end) mixed `[](mixed|int pos) mixed next(mixed pos) mixed prev(mixed pos)
There is no equivalent implemented already (in Pike), so I've no choice but to implement it myself (of course in C - Pike is soooo slow) :)
Regards, /Al
/ Brevbäraren