Sort using a custom comparator: Difference between revisions

Content added Content deleted
(added Ol)
Line 2,955: Line 2,955:
[Strings, strings, Sort, sort, this, This, Set, set, is, Is, of, Of, To, to, A, a]
[Strings, strings, Sort, sort, this, This, Set, set, is, Is, of, Of, To, to, A, a]
</pre>
</pre>

=={{header|Ol}}==
<lang scheme>
(import (scheme char))

(define (comp a b)
(let ((la (string-length a))
(lb (string-length b)))
(or
(> la lb)
(and (= la lb) (string-ci<? a b)))))

(print
(sort comp '(
"lorem" "ipsum" "dolor" "sit" "amet" "consectetur"
"adipiscing" "elit" "maecenas" "varius" "sapien"
"vel" "purus" "hendrerit" "vehicula" "integer"
"hendrerit" "viverra" "turpis" "ac" "sagittis"
"arcu" "pharetra" "id")))
</lang>


=={{header|ooRexx}}==
=={{header|ooRexx}}==