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

* 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))
	cons))))

#:Erik
-- 
  If this is not what you expected, please alter your expectations.