Subject: Re: deleting a nth element of a list
From: Erik Naggum <>
Date: 2000/05/25
Newsgroups: comp.lang.lisp
Message-ID: <>

* Arseny Slobodjuck
| Which is the best way to delete some element, whose number is known
| from a list?  Is it the following?

  Clever solution, but I tend to think that plain old ordinary list
  hacking is simpler:

(defun delete-nth (n list)
  (if (zerop n)
    (cdr list)
    (let ((cons (nthcdr (1- n) list)))
      (if cons
	(setf (cdr cons) (cddr cons))

  If this is not what you expected, please alter your expectations.