why there is a [] at the end of assocArray

michaelbi shunjie.bi at gmail.com
Wed Jan 19 13:15:35 UTC 2022


input:
00100
11110
10110
10111
10101
01111
00111
11100
10000
11001
00010
01010

     code:
     void main()
     {
     	foreach(line; 
File("input.txt").byLine.map!(a=>a.idup).array.transposed){
     		auto sortgroup = line.array.strip.sort.group.assocArray;	
     		writeln(sortgroup);
     	}
     }

output:
['1':7, '0':5]
['1':5, '0':7]
['1':8, '0':4]
['1':7, '0':5]
['1':5, '0':7]
[]

so why there is a [] at the end of assocArray printed? thanks.


More information about the Digitalmars-d-learn mailing list