Sort numbers lexicographically: Difference between revisions
Content added Content deleted
m (→{{header|REXX}}: changed a word to plural form.) |
m (→{{header|jq}}: shorten) |
||
Line 617: | Line 617: | ||
{{works with|jq}} |
{{works with|jq}} |
||
'''Works with gojq, the Go implementation of jq''' |
'''Works with gojq, the Go implementation of jq''' |
||
⚫ | |||
<lang jq> |
|||
⚫ | |||
# Example |
# Example |
||
Line 627: | Line 626: | ||
[1,10,11,12,13,2,3,4,5,6,7,8,9] |
[1,10,11,12,13,2,3,4,5,6,7,8,9] |
||
</pre> |
</pre> |
||
=={{header|Julia}}== |
=={{header|Julia}}== |
||
<lang julia>lexorderedsequence(n) = sort(collect(n > 0 ? (1:n) : n:1), lt=(a,b) -> string(a) < string(b)) |
<lang julia>lexorderedsequence(n) = sort(collect(n > 0 ? (1:n) : n:1), lt=(a,b) -> string(a) < string(b)) |