Sujet : Re: Please help
De : Nobody447095 (at) *nospam* here-nor-there.org (B. Pym)
Groupes : comp.lang.lispDate : 27. Jun 2025, 22:55:31
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <103n40g$ctu1$1@dont-email.me>
User-Agent : XanaNews/1.18.1.6
(defun duplic8 (the-list element)
(loop for x in the-list
if (eql x element)
append (list x x)
else
append (list x)))
If you like loop, I like this better:
(defun duplic8 (the-list element)
(loop for x in the-list
collect x
when (eql x element) collect x))
(define (duplicate the-list el)
(append-map
(lambda(x) (if (equal? el x) (list x x) (list x)))
the-list))