(sort deq ordf)
  deq: a deque
  ordf: a callable
  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.

If all of the deque's elements are numbers or characters, a good choice for ordf would be the built-in function ord.

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