# Sort (Kernel)

`Sort`(source dest orderFunction)

  Important

  SCI1.1 only.

  Sorts a list and puts the result into another list.

  Parameters: | source (k_list) – The list of items to sort. dest (k_list) – The destination list. The list may be the same as the source list. orderFunction (heapPtr) – An instance of an object with a doit() method (e.g. `Code`) that returns a numerical value indicating order.

  Example:

      (instance sortByDistanceToEgo of Code
              (properties)
              (method (doit theObj)
                      (return (gEgo distanceTo: theObj))
              )
      )

      ; Then somewhere in the script:
      (Sort myEventHandler myEventHandler sortByDistanceToEgo)