bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#67580: 29.1; Anomaly in cl-destructuring-bind &rest handling


From: Lassi Kortela
Subject: bug#67580: 29.1; Anomaly in cl-destructuring-bind &rest handling
Date: Sat, 2 Dec 2023 02:38:41 +0200
User-agent: Mozilla Thunderbird

;; These three return the first value to which `a' was bound, which is
;; probably OK.

(cl-destructuring-bind (a &rest a) (list 1 2 3 4)
  a)
;; => 1

(cl-destructuring-bind (b a &rest a) (list 1 2 3 4)
  a)
;; => 2

(cl-destructuring-bind (a b &rest b) (list 1 2 3 4)
  a)
;; => 1

;; These two produce the anomaly. When the &rest parameter has the
;; same variable same as a positional parameter, and there are at
;; least two positional parameters, then &rest tries to decode the
;; list tail from whatever value was first assigned to the variable by
;; a positional parameter.

(cl-destructuring-bind (a b &rest a) (list 1 2 3 4)
  a)
;; error: (wrong-type-argument listp 1)

(cl-destructuring-bind (a a &rest a) (list 1 2 3 4)
  a)
;; error: (wrong-type-argument listp 1)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]