From: Philipp Michels
Subject: function delete
Date: 
Message-ID: <91ftsh$2ks$07$1@news.t-online.com>
Hi,

I have to write a function "my-delete" which delete a element e.g. b from a
list (a b c a b c). This function should be write with setf  .
It should be similar to the funtcion "delete" which is already def. in
CommonLisp.
Where can i find the sources of the CommonLISP with all the functions e.g.
"first", "rest" , "cons" ....

Thanks

Philipp

From: Barry Margolin
Subject: Re: function delete
Date: 
Message-ID: <HQY_5.3$vM5.244@burlma1-snr2>
In article <···············@news.t-online.com>,
Philipp Michels <·········@t-online.de> wrote:
>Hi,
>
>I have to write a function "my-delete" which delete a element e.g. b from a
>list (a b c a b c). This function should be write with setf  .
>It should be similar to the funtcion "delete" which is already def. in
>CommonLisp.
>Where can i find the sources of the CommonLISP with all the functions e.g.
>"first", "rest" , "cons" ....

CMUCL comes with full sources.

-- 
Barry Margolin, ······@genuity.net
Genuity, Burlington, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.
From: Kenny Tilton
Subject: Re: function delete
Date: 
Message-ID: <3A3D104F.B19ADD3@nyc.rr.com>
Paul Graham in "On Lisp" showed how to implement higher-order Lisp functions
with more primitive ones. But I do not think he did lower-level guys like
'delete.

But if this is schoolwork, I /think/ they want you to understand cons structure
better. So go back to the beginning of the book where they diagram a list as a
series of cons cells, then do the same with (a b c a b c), then just work out
how to walk through the list re-splicing the cons list by coding (setf (cdr
input) <next-undeleted-cons>). (Yes, you can setf (cdr X) and does what you
might think, change the cdr of X.

After it works for 'b, see if you can get it to work for 'a, a little trickier
case you should remember later on when using delete.

Hints: there is no such thing as a list in Lisp, there are cons cells. (consp
'(a b)=>t) So the parameter L bound to the list you pass into the function
actually holds a cons. You can look at what is "in" the cons via (car L), and
you can see what is the next cons cell (if any) via (cdr L).

t

Philipp Michels wrote:

> Hi,
>
> I have to write a function "my-delete" which delete a element e.g. b from a
> list (a b c a b c). This function should be write with setf  .
> It should be similar to the funtcion "delete" which is already def. in
> CommonLisp.
> Where can i find the sources of the CommonLISP with all the functions e.g.
> "first", "rest" , "cons" ....
>
> Thanks
>
> Philipp