(sort deq (? ordf ord))
  deq: a deque
  ordf: a callable (optional)
  returns a deque
F

Returns a sorted copy of a deque.

ordf must be a function which can accept any two elements from deq as arguments. It must return one of the symbols ==, < or > to represent the relative ordering of those two elements.

The comparison function defaults to the built-in function ord. Custom comparison functions will have significantly worse performance.

(let sorted (sort "Hello, world!"))
(prn sorted) ; prints  !,Hdellloorw
swap-remove-start!
sort!