Skip to content

Commit

Permalink
Make clear when we're using the compat function for length> and `…
Browse files Browse the repository at this point in the history
…length=`.
  • Loading branch information
okamsn committed Feb 14, 2024
1 parent 7b7e46d commit 4ddd50c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions loopy-destructure.el
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
(require 'compat)
(require 'loopy-misc)
(require 'loopy-instrs)
(eval-and-compile (require 'pcase))
(require 'pcase)
(require 'seq)
(require 'subr-x)

Expand Down Expand Up @@ -374,7 +374,7 @@ MAP-OR-KEY-VARS is whether there are map or key variables."
(opt-len (length opt-vars)))
;; We allow the variable form to be shorter than the
;; destructured sequence.
`(and (pred (pcase--flip length> ,(1- pos-len)))
`(and (pred (pcase--flip ,(compat-function length>) ,(1- pos-len)))
,@(cl-loop for var in pos-vars
for idx from 0
collect `(app (pcase--flip aref ,idx)
Expand All @@ -400,8 +400,8 @@ MAP-OR-KEY-VARS is whether there are map or key variables."
;; the one variable was not supplied and we
;; need to check the remaining ones.
`(and ,(if use->=
`(pred (pcase--flip length> ,(1- checked-len)))
`(pred (pcase--flip length= ,checked-len)))
`(pred (pcase--flip ,(compat-function length>) ,(1- checked-len)))
`(pred (pcase--flip ,(compat-function length=) ,checked-len)))
;; Variables that should be bound with the value in
;; the array.
,@(cl-loop
Expand Down Expand Up @@ -449,7 +449,7 @@ MAP-OR-KEY-VARS is whether there are map or key variables."
(rest-pat (loopy--get-var-pattern rest-var))
(seqsym (gensym "seqsym")))
;; Rec-checking the length is fast for arrays.
`((or (and (pred (pcase--flip length> ,len-sum))
`((or (and (pred (pcase--flip ,(compat-function length>) ,len-sum))
(app (pcase--flip substring ,len-sum) ; 0-indexed
,rest-pat))
(app (lambda (,seqsym) (substring ,seqsym 0 0))
Expand Down

0 comments on commit 4ddd50c

Please sign in to comment.