Function: sort

sort is a function defined in fns.c.

Signature

(sort SEQ PREDICATE)

Documentation

Sort SEQ, stably, comparing elements using PREDICATE.

Returns the sorted sequence. SEQ should be a list or vector. SEQ is modified by side effects. PREDICATE is called with two elements of SEQ, and should return non-nil if the first element should sort before the second.

Probably introduced at or before Emacs version 16.

Source Code

// Defined in /usr/src/emacs/src/fns.c
{
  if (CONSP (seq))
    seq = sort_list (seq, predicate);
  else if (VECTORP (seq))
    sort_vector (seq, predicate);
  else if (!NILP (seq))
    wrong_type_argument (Qlist_or_vector_p, seq);
  return seq;
}