<div dir="ltr">I'm trying to analyze the usage of certain words in a large number of spam emails, and I want for every interesting word a list of 'providors', that mentioned that word. with associative arrays I hoped to get it by using array["interestingworde].<div>
<br></div><div>And I have to refer outside from sort(x,y) as associative arrays have no order, I'll always have to sort a key-array according to values obtained through the associative array.</div><div>It's supposed to be a delegate anyway, otherwise the least it could do is throw a compilation error.</div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">2014-05-28 12:53 GMT+02:00 Wanderer via Digitalmars-d-learn <span dir="ltr"><<a href="mailto:digitalmars-d-learn@puremagic.com" target="_blank">digitalmars-d-learn@puremagic.com</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Wednesday, 28 May 2014 at 10:10:41 UTC, maarten van damme via<div><div class="h5"><br>
Digitalmars-d-learn wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
an anyone explain me what I'm doing wrong here :<br>
<br>
[code]<br>
dstring[][dstring] providor_symbol_map;<br>
...<br>
<br>
writeln(providor_symbol_map.<u></u>keys.sort!((x,y)=>providor_<u></u>symbol_map[x].length>=<u></u>providor_symbol_map[y].length)<u></u>);<br>
[/code]<br>
<br>
output:<br>
core.exception.RangeError@std.<u></u>algorithm(9429): Range violation<br>
</blockquote>
<br></div></div>
"dstring[][dstring]" declaration looks a bit obscure to me...<br>
what do you intent with it, "array of maps" or "map of arrays"?<br>
<br>
Also, it looks unnatural that inside sorting lambda, you refer<br>
outside from it (back to providor_symbol_map variable). Ideally,<br>
you should only use variables x and y. Does D support sorting by<br>
map entries instead of by keys only or by values only?<br>
</blockquote></div><br></div>