From: Onay Urfalioglu
Subject: simple list (cons) editing
Date: 
Message-ID: <42fba73d$0$6980$9b4e6d93@newsread2.arcor-online.net>
* to cut the next cons cell from list:

(setf l (list 'a 'b 'c))
> (A B C)
(setf (cdr l) (cdr (cdr l)))
> (C)
l
> (A C)

may be used. I just wonder whether there is a builtin function/macro in
common-lisp spec for this functionality (or similar to this...)

regards

-- 
(+::+) oni (+::+)
(I already try to be as amusing as possible, my master!)

From: Onay Urfalioglu
Subject: Re: simple list (cons) editing
Date: 
Message-ID: <42fbb02d$0$6992$9b4e6d93@newsread2.arcor-online.net>
Onay Urfalioglu wrote:

> * to cut the next cons cell from list:
> 
> (setf l (list 'a 'b 'c))
>> (A B C)
> (setf (cdr l) (cdr (cdr l)))
>> (C)
> l
>> (A C)
> 
> may be used. I just wonder whether there is a builtin function/macro in
> common-lisp spec for this functionality (or similar to this...)
> 
> regards
> 

Ok ok:

(setf list (list 'a 'b 'c))
(pop (cdr list))
list
> (A C)

(push 'b (cdr list))
list
> (A B C)


sorry, i am learning ;-)


-- 
(+::+) oni (+::+)
(I already try to be as amusing as possible, my master!)
From: Thomas A. Russ
Subject: Re: simple list (cons) editing
Date: 
Message-ID: <ymibr3zf2tp.fsf@sevak.isi.edu>
Onay Urfalioglu <·····@gmx.net> writes:

> 
> * to cut the next cons cell from list:
> 
> (setf l (list 'a 'b 'c))
> > (A B C)
> (setf (cdr l) (cdr (cdr l)))
> > (C)
> l
> > (A C)
> 
> may be used. I just wonder whether there is a builtin function/macro in
> common-lisp spec for this functionality (or similar to this...)

It's hard to see how much more concise than

  (setf (cdr l) (cddr l))

you could really get.  But if you want it, there's always macros:

(defmacro splice-out-cdr (list)
  `(setf (cdr ,list) (cddr ,list)))

(splice-out-cdr l)

-- 
Thomas A. Russ,  USC/Information Sciences Institute
From: Harald Hanche-Olsen
Subject: Re: simple list (cons) editing
Date: 
Message-ID: <pcofytbj77r.fsf@shuttle.math.ntnu.no>
+ ···@sevak.isi.edu (Thomas A. Russ):

| It's hard to see how much more concise than
| 
|   (setf (cdr l) (cddr l))
| 
| you could really get.

Your newsfeed has got to be pretty bad if you didn't see the OP's own
(pop (cdr l)), posted four days ago.  (I didn't think of that either.)
You should complain to your provider.

-- 
* Harald Hanche-Olsen     <URL:http://www.math.ntnu.no/~hanche/>
- Debating gives most of us much more psychological satisfaction
  than thinking does: but it deprives us of whatever chance there is
  of getting closer to the truth.  -- C.P. Snow