On Mon, Dec 9, 2024 at 7:59 PM <to...@tuxteam.de> wrote: > > (= a b) is equivalent to (not (or (< a b) (> a b))) > > Yes, but for that, you have to know what "=" is. Is it eq? Is it > eqv? Is it equal? (yeah, lame pun with question marks). Or is it > (see below)? >
It's equal in the sense of (not (or (< a b) (> a b)). If < is Scheme < (i.e. comparing numbers), then this is completely equivalent with Scheme =. > > The reason why you need to pass less to sort is that sort needs a way to > > determine when an object should go before another one. Let's for example > > take the example of a list of neuronal spike events. Each event is (TIME > . > > ID). It could be unsorted because the data might come from different > > detectors. To sort the list in time, we would call sort like this: > > > > (sort '((0.73 . 7) (0.23 . 3) (0.54 . 17) (0.27 . 98)) (lambda (x y) (< > > (car x) (car y)))) > > So here you'd need your equal to be (eq (car x) (car y)), right? > As I've tried to convey, you don't need equal when sorting using `sort'. But the equal corresponding to < is = in Scheme.