Re: [PHP-DEV] How about implementing more data structures (ie Map, Set)

2012-12-21 Thread Victor Berchet
I don't have much time to work on this now. More next year ! Have ahappy Xmas. On 12/20/2012 09:43 PM, Levi Morrison wrote: As mentioned earlier, I've been working on a library(https://github.com/morrisonlevi/Ardent) with an honest effort to make the data-structures usable in several different

Re: [PHP-DEV] How about implementing more data structures (ie Map, Set)

2012-12-20 Thread Levi Morrison
As mentioned earlier, I've been working on a library(https://github.com/morrisonlevi/Ardent) with an honest effort to make the data-structures usable in several different programming styles. I've tried several designs, but requiring something to implement a `Comparable` interface turned out to not

Re: [PHP-DEV] How about implementing more data structures (ie Map, Set)

2012-12-18 Thread Victor Berchet
On 12/18/2012 07:46 PM, Anthony Ferrara wrote: Victor, If you give a closer look to my example, you will notice a difference: $map[$setA] and $map[$setB] point to the same storage which I think is not possible with SPLObjectStorage. Well, how could you do that? Without implementin

Re: [PHP-DEV] How about implementing more data structures (ie Map, Set)

2012-12-18 Thread Anthony Ferrara
Victor, If you give a closer look to my example, you will notice a difference: > $map[$setA] and $map[$setB] point to the same storage which I think is not > possible with SPLObjectStorage. > Well, how could you do that? Without implementing object comparison methods at least (which is outside t

Re: [PHP-DEV] How about implementing more data structures (ie Map, Set)

2012-12-18 Thread Victor Berchet
I am happy to see some interest in this discussion, I'll try to give more details in the coming days. To clarify, my first example should be: $setA = new Set(); $setA->append('a'); $setA->append('a'); $setB = new Set(); $setB->append('a'); // 'a' instead of 'b' $setA == $setB; Cheers, Victor

Re: [PHP-DEV] How about implementing more data structures (ie Map, Set)

2012-12-18 Thread Anthony Ferrara
Guys, PHP arrays are a great one-size-fits-all data structure. But like all one-size-fits-all , jack-of-all-trades usually means master of none. There are definitely benefits to using specific data structures if implemented correctly under the hood. A good example of this is a Queue. Implemented

Re: [PHP-DEV] How about implementing more data structures (ie Map, Set)

2012-12-18 Thread Ángel González
On 18/12/12 15:43, Victor Berchet wrote: > Dear all: > > I would like to get your feedback on implementing some more data > structure in the PHP core. (...) I think this could be summarised as "allow objects as keys for arrays". Which would give the Map behavior. Implementing Set from that is stra

Re: [PHP-DEV] How about implementing more data structures (ie Map, Set)

2012-12-18 Thread jpauli
On Tue, Dec 18, 2012 at 3:43 PM, Victor Berchet wrote: > Dear all: > > I would like to get your feedback on implementing some more data structure > in the PHP core. > > Things like Set, Map could be really helpful. > > A Set would be an unordered collection with no duplicate elements (same as > i

Re: [PHP-DEV] How about implementing more data structures (ie Map, Set)

2012-12-18 Thread William Fitch
On Dec 18, 2012, at 9:43 AM, Victor Berchet wrote: > Dear all: > > I would like to get your feedback on implementing some more data structure in > the PHP core. > > Things like Set, Map could be really helpful. > > A Set would be an unordered collection with no duplicate elements (same as in

[PHP-DEV] How about implementing more data structures (ie Map, Set)

2012-12-18 Thread Victor Berchet
Dear all: I would like to get your feedback on implementing some more data structure in the PHP core. Things like Set, Map could be really helpful. A Set would be an unordered collection with no duplicate elements (same as in Python) $setA = new Set(); $setA->append('a'); $setA->append('a'