Ordered words: Difference between revisions

Add functional Common Lisp version
m (→‎{{header|Wren}}: Minor tidy)
imported>GoulashAmateur
(Add functional Common Lisp version)
Line 1,352:
"biopsy" "chilly" "choosy" "choppy" "effort" "floppy" "glossy" "knotty")
</syntaxhighlight>
 
Or in a more functional way:
<syntaxhighlight lang="lisp">(defun orderedp (word)
(apply #'char<= (coerce word 'list)))
 
(let* ((words (uiop:read-file-lines "~/Downloads/unixdict.txt"))
(ordered (delete-if-not #'orderedp words))
(maxlen (apply #'max (mapcar #'length ordered)))
(result (delete-if-not (lambda (l) (= l maxlen)) ordered :key #'length)))
(format t "~{~A~^, ~}" result))</syntaxhighlight>
{{out}}
<pre>abbott, accent, accept, access, accost, almost, bellow, billow, biopsy, chilly, choosy, choppy, effort, floppy, glossy, knotty</pre>
 
=={{header|Cowgol}}==