From ... From: Erik Naggum Subject: Re: Novice question -- inserting element in list Date: 1996/02/06 Message-ID: <19960206T162730Z@arcana.naggum.no>#1/1 X-Deja-AN: 138250909 references: <4f6rkb$i11@watt.electriciti.com> organization: Naggum Software; +47 2295 0313 newsgroups: comp.lang.lisp [Gregory Santos] | I would simply like to insert an element into the central portion of a | list (not the beginning or end) with the highest degree of efficiency | possible, knowing only the node after or before which I wish to insert | the new node. (defun insert-after (newelt list index) "Insert NEWELT in LIST after the INDEXth cell. Returns LIST." (let ((cell (nthcdr index list))) (setf (cdr cell) (cons newelt (cdr cell)))) list) # -- BEOL and ENDOL: the ultimate general purpose programming languages