On Tue, Jan 25, 2022 at 02:46:43AM +, forkit via Digitalmars-d-learn wrote:
> On Tuesday, 25 January 2022 at 02:12:50 UTC, H. S. Teoh wrote:
> >
> > That's the *easy* way out?? Try this instead:
> >
> > aaTable.keys.sort.each!((k) {
> > aaTable[k].keys.sort.each!((kk) {
> >
On Tuesday, 25 January 2022 at 02:12:50 UTC, H. S. Teoh wrote:
That's the *easy* way out?? Try this instead:
aaTable.keys.sort.each!((k) {
aaTable[k].keys.sort.each!((kk) {
writefln("%s:%s:%s", k, kk, aaTable[k][kk]);
});
On Tue, Jan 25, 2022 at 02:04:26AM +, forkit via Digitalmars-d-learn wrote:
[...]
> // --
> module test;
>
> import std;
>
> void main()
> {
> auto aaTable =
> ([
>"typeB" : [ 10002 : [1, 1, 0, 0, 0, 0, 0, 0],
>10001 : [1, 0, 0, 0, 0, 0, 0, 0]
>
On Tuesday, 25 January 2022 at 00:43:07 UTC, forkit wrote:
oh. thanks :-)
I will get that integrated into my example code, and will post
again, once it's working (so others can learn too)
ok.. so I took the easy way out ;-)
output is now ordered:
typeA:10003:[1, 1, 1, 0, 0, 0, 0, 0]
t
On Tuesday, 25 January 2022 at 00:39:05 UTC, H. S. Teoh wrote:
AA's are unordered containers. Do not rely on entries to appear
in any specific order when you traverse an AA; it is
implementation-dependent and may differ from OS to OS /
platform to platform / sequence of operations performed
On Tuesday, 25 January 2022 at 00:23:40 UTC, forkit wrote:
another example:
output is:
typeA:
10001:[0, 0, 1, 1, 1, 1, 1, 1]
10002:[0, 0, 0, 1, 1, 1, 1, 1]
typeB:
10005:[0, 0, 0, 0, 0, 0, 1, 1]
10003:[0, 0, 0, 0, 1, 1, 1, 1]
10004:[0,
On Tue, Jan 25, 2022 at 12:23:40AM +, forkit via Digitalmars-d-learn wrote:
> so I'm trying to understand why the output of the code below, is in
> reverse order of the declaration (and how to fix it so that it outputs
> in an ordered way)
AA's are unordered containers. Do not rely on entries
so I'm trying to understand why the output of the code below, is
in reverse order of the declaration (and how to fix it so that it
outputs in an ordered way)
i.e. output is:
typeA:
A2:A2value
A1:A1value
typeB:
B3:B3value
B2:B2value
B1:B1value
// --
modu