On Fri, Aug 23, 2013 at 11:22:47AM -0700, Sean Kelly wrote:
> On Jul 31, 2013, at 7:55 AM, Dicebot wrote:
>
> > On Wednesday, 31 July 2013 at 14:43:21 UTC, Daniel Kozak wrote:
> >> is there a way for AA to behave same as PHP?
> >
> > I doubt it. This snippet suggests that AA's in PHP are not sim
On Jul 31, 2013, at 7:55 AM, Dicebot wrote:
> On Wednesday, 31 July 2013 at 14:43:21 UTC, Daniel Kozak wrote:
>> is there a way for AA to behave same as PHP?
>
> I doubt it. This snippet suggests that AA's in PHP are not simply AA's and do
> additionally track insertion order (or use some simil
H. S. Teoh:
...
Your answer was really too much short, so I have asked you a
question in that enhancement request :-)
Bye,
bearophile
H. S. Teoh:
...
On this subject, I added this request to Bugzilla:
http://d.puremagic.com/issues/show_bug.cgi?id=10733
Bye,
bearophile
On Fri, Aug 23, 2013 at 01:54:27PM +0200, Daniel Kozak wrote:
> https://github.com/Kozzi11/Trash/blob/master/util/orderedaa.d
[...]
Neat!
Is a doubly-linked list really necessary for the hash buckets? You could
save on some memory & improve performance slightly if you use a
singly-linked list for
When I do some cleanups, I find some bugs and after fixing them,
my own OrderedAA implementation does not beat builtin hash
anymore :(. But speed is still really near to builtin AA's.
On Thursday, 22 August 2013 at 07:59:05 UTC, Daniel Kozak wrote:
On Wednesday, 31 July 2013 at 14:55:55 UTC, D
https://github.com/Kozzi11/Trash/blob/master/util/orderedaa.d
On Thursday, 22 August 2013 at 08:41:13 UTC, monarch_dodra wrote:
On Thursday, 22 August 2013 at 07:59:05 UTC, Daniel Kozak wrote:
On Wednesday, 31 July 2013 at 14:55:55 UTC, Dicebot wrote:
On Wednesday, 31 July 2013 at 14:43:21 UTC,
On Thursday, 22 August 2013 at 08:41:13 UTC, monarch_dodra wrote:
On Thursday, 22 August 2013 at 07:59:05 UTC, Daniel Kozak wrote:
On Wednesday, 31 July 2013 at 14:55:55 UTC, Dicebot wrote:
On Wednesday, 31 July 2013 at 14:43:21 UTC, Daniel Kozak
wrote:
is there a way for AA to behave same as
On Thursday, 22 August 2013 at 07:59:05 UTC, Daniel Kozak wrote:
On Wednesday, 31 July 2013 at 14:55:55 UTC, Dicebot wrote:
On Wednesday, 31 July 2013 at 14:43:21 UTC, Daniel Kozak wrote:
is there a way for AA to behave same as PHP?
I doubt it. This snippet suggests that AA's in PHP are not
On Wednesday, 31 July 2013 at 14:55:55 UTC, Dicebot wrote:
On Wednesday, 31 July 2013 at 14:43:21 UTC, Daniel Kozak wrote:
is there a way for AA to behave same as PHP?
I doubt it. This snippet suggests that AA's in PHP are not
simply AA's and do additionally track insertion order (or use
som
On 7/31/13 12:56 PM, H. S. Teoh wrote:
On Wed, Jul 31, 2013 at 12:51:25PM -0300, Ary Borenszweig wrote:
On 7/31/13 12:05 PM, bearophile wrote:
Daniel Kozak:
is there a way for AA to behave same as PHP?
D associative arrays are based on hashing, so they do not keep the
order of the items. Th
Ary Borenszweig:
However in Ruby 1.9 they are ordered.
You only need to store in each bucket entry a pointer to the
next bucket. Then traversing the hash is super fast (just
follow the links) while preserving insertion order. Accessing
by key still uses the buckets and entries (if that's how
On Wed, Jul 31, 2013 at 12:51:25PM -0300, Ary Borenszweig wrote:
> On 7/31/13 12:05 PM, bearophile wrote:
> >Daniel Kozak:
> >
> >> is there a way for AA to behave same as PHP?
> >
> >D associative arrays are based on hashing, so they do not keep the
> >order of the items. This is true in Python to
On 7/31/13 12:05 PM, bearophile wrote:
Daniel Kozak:
is there a way for AA to behave same as PHP?
D associative arrays are based on hashing, so they do not keep the order
of the items. This is true in Python too. The Python standard library
has a hash-based ordered dict that keeps the insert
I remember there is a trick to find the address of a D
associative array key given its value address,
Perhaps you need a better explanation for that. Let's say your
data structure is:
final class OrderedAA(TK, TV) {
struct MV {
TV item;
MV* pred, succ;
}
private M
Daniel Kozak:
is there a way for AA to behave same as PHP?
D associative arrays are based on hashing, so they do not keep
the order of the items. This is true in Python too. The Python
standard library has a hash-based ordered dict that keeps the
insertion order of the keys. There is no su
On Wednesday, 31 July 2013 at 14:55:55 UTC, Dicebot wrote:
On Wednesday, 31 July 2013 at 14:43:21 UTC, Daniel Kozak wrote:
is there a way for AA to behave same as PHP?
I doubt it. This snippet suggests that AA's in PHP are not
simply AA's and do additionally track insertion order (or use
som
On Wednesday, 31 July 2013 at 15:00:34 UTC, Daniel Kozak wrote:
Thanks I will use plain array, it is not perfect but better
than nothing :)
For some reason this (unordered keys) wasn't documented on the
website, but it will be soon.
On Wednesday, 31 July 2013 at 14:43:21 UTC, Daniel Kozak wrote:
is there a way for AA to behave same as PHP?
I doubt it. This snippet suggests that AA's in PHP are not simply
AA's and do additionally track insertion order (or use some
similar trick). Data in associative arrays is organized i
On Wed, Jul 31, 2013 at 04:41:14PM +0200, Daniel Kozak wrote:
>
> D:
>
> foreach(key, val; ["query" : 1, "count" : 2]) writeln(key); // print
> count query
> foreach(key, val; ["count" : 1, "query" : 2]) writeln(key); // print
> count query too
>
> PHP:
> foreach(["query" => 1,"count"=>2] as $ke
D:
foreach(key, val; ["query" : 1, "count" : 2])
writeln(key); // print count query
foreach(key, val; ["count" : 1, "query" : 2])
writeln(key); // print count query too
PHP:
foreach(["query" => 1,"count"=>2] as $key => $val)
echo $key; // print query count
foreach(["count" => 1,"
D:
foreach(key, val; ["query" : 1, "count" : 2]) writeln(key); //
print count query
foreach(key, val; ["count" : 1, "query" : 2]) writeln(key); //
print count query too
PHP:
foreach(["query" => 1,"count"=>2] as $key => $val)
echo $key; // print query count
foreach(["count" => 1,"query"=>2] a
22 matches
Mail list logo