all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#67580: 29.1; Anomaly in cl-destructuring-bind &rest handling
@ 2023-12-02  0:38 Lassi Kortela
  0 siblings, 0 replies; only message in thread
From: Lassi Kortela @ 2023-12-02  0:38 UTC (permalink / raw)
  To: 67580

;; 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)





^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-12-02  0:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-02  0:38 bug#67580: 29.1; Anomaly in cl-destructuring-bind &rest handling Lassi Kortela

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.