Hash :
2bc2b54c
Author :
Thomas de Grivel
Date :
2023-07-11T13:22:41
(compare 'a 'b)
=> -1
(compare 'a "a")
=> -1
(compare '(a b 1) '(a b 2))
=> -1
(defstruct fruit price weight)
(defmethod compare ((a fruit) (b fruit))
(compare (* (fruit-price a) (fruit-weight a))
(* (fruit-price b) (fruit-weight b))))
(let ((apple (make-fruit :price 0.3 :weight 100))
(orange (make-fruit :price 4.5 :weight 1000)))
(compare apple orange))
=> -1
This project welcomes COMPARE methods for types that have an atomic type specifier, with an emphasis on speed and functional correctness.
To submit contributions, just fork the project and submit a pull request.