• Re: Please help

    From B. Pym@Nobody447095@here-nor-there.org to comp.lang.lisp on Fri Jun 27 21:55:31 2025
    From Newsgroup: comp.lang.lisp

    (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))
    --- Synchronet 3.21d-Linux NewsLink 1.2