If you are using generic lisp, I recommend the Common Lisp Hyper Spec . In your case, the documentation for the sort function will be useful. Here you can see that it has a second parameter: a predicate. The predicate takes two arguments and returns whether the second is stronger than the first.
Say you have a dist function that measures the distance between two points. To compare two points at a distance to your start-point , you need the following lambda:
Therefore, you should put it in the place of the predicate (second position) in the sort argument list.
Necto source share