English cardinal anagrams: Difference between revisions
Content added Content deleted
Thundergnat (talk | contribs) m (→{{header|Wren}}: the largest groups are all jumbled together) |
(→{{header|Wren}}: Largest groups are now identified as such.) |
||
Line 64: | Line 64: | ||
=={{header|Wren}}== |
=={{header|Wren}}== |
||
{{improve|Wren|For the stretch "largest groups" part; there are six groups of eighteen values. All of the values for those six groups are shown, but they are all intermixed (sorted together) as if they are all in one group. They're not.}} |
|||
{{libheader|Wren-sort}} |
{{libheader|Wren-sort}} |
||
{{libheader|Wren-fmt}} |
|||
I've reused the code for determining the number names from the related task. |
I've reused the code for determining the number names from the related task. |
||
<syntaxhighlight lang="ecmascript">import "./sort" for Sort |
<syntaxhighlight lang="ecmascript">import "./sort" for Sort |
||
Line 140: | Line 140: | ||
if (v.count > max) { |
if (v.count > max) { |
||
max = v.count |
max = v.count |
||
largest = v |
largest = [v] |
||
} else if (v.count == max) { |
} else if (v.count == max) { |
||
largest. |
largest.add(v) |
||
} |
} |
||
} |
} |
||
var n = limit == 1000 ? 3 : 4 |
|||
Fmt.print("\nLargest group(s) of English cardinal anagrams up to $,d:", limit) |
Fmt.print("\nLargest group(s) of English cardinal anagrams up to $,d:", limit) |
||
largest.sort { |l1, l2| l1[0] < l2[0] } |
|||
System.print(largest.map { |l| "[" + l.join(" ") + "]" }.join("\n")) |
|||
if (limit == 1000) System.print() |
if (limit == 1000) System.print() |
||
}</syntaxhighlight> |
}</syntaxhighlight> |
||
Line 161: | Line 161: | ||
Largest group(s) of English cardinal anagrams up to 1,000: |
Largest group(s) of English cardinal anagrams up to 1,000: |
||
679 697 769 796 967 976 |
[679 697 769 796 967 976] |
||
Count of English cardinals up to 10,000: 2,534 |
Count of English cardinals up to 10,000: 2,534 |
||
Largest group(s) of English cardinal anagrams up to 10,000: |
Largest group(s) of English cardinal anagrams up to 10,000: |
||
1679 1697 1769 1796 1967 1976 |
[1679 1697 1769 1796 1967 1976 6179 6197 6791 6971 7169 7196 7691 7961 9167 9176 9671 9761] |
||
[2679 2697 2769 2796 2967 2976 6279 6297 6792 6972 7269 7296 7692 7962 9267 9276 9672 9762] |
|||
3679 3697 3769 3796 3967 3976 4679 4697 4769 4796 4967 4976 |
|||
[3679 3697 3769 3796 3967 3976 6379 6397 6793 6973 7369 7396 7693 7963 9367 9376 9673 9763] |
|||
5679 5697 5769 5796 5967 5976 6179 6197 6279 6297 6379 6397 |
|||
6479 6497 |
[4679 4697 4769 4796 4967 4976 6479 6497 6794 6974 7469 7496 7694 7964 9467 9476 9674 9764] |
||
[5679 5697 5769 5796 5967 5976 6579 6597 6795 6975 7569 7596 7695 7965 9567 9576 9675 9765] |
|||
6971 6972 6973 6974 6975 6978 7169 7196 7269 7296 7369 7396 |
|||
⚫ | |||
7469 7496 7569 7596 7691 7692 7693 7694 7695 7698 7869 7896 |
|||
⚫ | |||
9167 9176 9267 9276 9367 9376 9467 9476 9567 9576 9671 9672 |
|||
9673 9674 9675 9678 9761 9762 9763 9764 9765 9768 9867 9876 |
|||
</pre> |
</pre> |