ruricolist / serapeum

Utilities beyond Alexandria
MIT License
415 stars 41 forks source link

LENGTH<= and LENGTH>= are incorrectly implemented for the non-binary case #147

Closed miklos1 closed 1 year ago

miklos1 commented 1 year ago

A failing example:

CL-USER> (length>= '() '(1) '(2))
T

The above should clearly return NIL, since '() is strictly shorter than '(1). Looking at the code, the reason is obvious:

(defun length>= (&rest seqs)
  "Is each length-designator in SEQS longer or as long as the next?
A length designator may be a sequence or an integer."
  (not (apply #'length< seqs)))

>= is the logical inversion of < only in the two-argument case, but not as an n-ary operator.

ruricolist commented 1 year ago

Thanks for reporting this.