Jump to content

Sort numbers lexicographically: Difference between revisions

m
m (→‎{{header|REXX}}: changed a word to plural form.)
m (→‎{{header|jq}}: shorten)
Line 617:
{{works with|jq}}
'''Works with gojq, the Go implementation of jq'''
<lang jq>def sort_range($a;$b): [range($a;$b) | tostring] | sort | mapsort_by(tonumbertostring);
<lang jq>
def sort_range($a;$b): [range($a;$b) | tostring] | sort | map(tonumber);
 
# Example
Line 627 ⟶ 626:
[1,10,11,12,13,2,3,4,5,6,7,8,9]
</pre>
 
=={{header|Julia}}==
<lang julia>lexorderedsequence(n) = sort(collect(n > 0 ? (1:n) : n:1), lt=(a,b) -> string(a) < string(b))
2,509

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.