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

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

Re: FW: How to avoid compiler warning `unused lexical variable' for `dol


From: Jean Louis
Subject: Re: FW: How to avoid compiler warning `unused lexical variable' for `dolist' or `dotimes'?
Date: Fri, 8 Jan 2021 05:52:46 +0300
User-agent: Mutt/2.0 (3d08634) (2020-11-07)

Now replacing:

(defun list-append-elts-to-first-cons (list)
    "Cons with FIRST-ELT . FIRST-ELT OTHER-ELT"
  (let ((new-list '())
 (times (length list)))
    (dotimes (nr times new-list)
      (let* ((item (elt list nr))
      (first (car item)))
 (push (cons first (list item)) new-list)))))

(list-append-elts-to-first-cons '((1 2 3)))
((1 (1 2 3)))

(defun list-append-elts-to-first-cons (list)
  "Cons with FIRST-ELT . FIRST-ELT OTHER-ELT"
  (mapcar (lambda (item) (cons (car item) (list item))) list))

(list-append-elts-to-first-cons '((1 2 3)))
((1 (1 2 3)))



reply via email to

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