Compare length of two strings: Difference between revisions

Added Racket solution
(Added Racket solution)
Line 1,905:
Beneath the pool,
By water cool,
</pre>
 
=={{header|Racket}}==
<syntaxhighlight lang="racket">
#lang racket
 
(define strings '("abcd" "123456789" "abcdef" "1234567"))
 
(for ([i (sort strings > #:key string-length)])
(printf "'~a' is length ~a~n" i (string-length i)))
</syntaxhighlight>
{{out}}
<pre>
'123456789' is length 9
'1234567' is length 7
'abcdef' is length 6
'abcd' is length 4
</pre>
 
11

edits