Newsgroups: comp.lang.prolog
Path: cantaloupe.srv.cs.cmu.edu!bb3.andrew.cmu.edu!nntp.sei.cmu.edu!cis.ohio-state.edu!math.ohio-state.edu!howland.reston.ans.net!torn!watserv3.uwaterloo.ca!news
From: "Mike C. Fletcher" <mcfletch>
Subject: Re: delete an item of list
Content-Type: text/plain; charset=us-ascii
Message-ID: <DJw1F4.1CD@watserv3.uwaterloo.ca>
To: faundea1@uni2a.unige.ch
Sender: news@watserv3.uwaterloo.ca
Nntp-Posting-Host: watarts.uwaterloo.ca
Content-Transfer-Encoding: 7bit
Organization: University of Waterloo
References: <faundea1-2012951429260001@maclab1>
Mime-Version: 1.0
Date: Wed, 20 Dec 1995 13:57:04 GMT
X-Mailer: Mozilla 1.12 (X11; I; OSF1 V3.2 alpha)
X-Url: news:faundea1-2012951429260001@maclab1
Lines: 34

Hi there!

Hints:
An element is in a list if;
The element is either the single-element head of the list, or it is in the tail
of the list (try using a "before" accumulator).
To delete an element, concatenate what comes before and what comes after it.
Edit is a big operation, do you mean substitute?  That's concatenate what's
before, what's new and what's after (forgetting about what's not wanted).

Oh, I'm not an expert, just a dabbler, so don't give up on finding more
efficient or elegant ways.
-- 
faundea1@uni2a.unige.ch (Alex Faundez) wrote:
>Hi,
>is there  simple rule for deleting an element of a list? The list is
>simply something as [the,cat,eats,the ,mouse].
>
>And what about find and edit rules?
>
>I'm in a Prolog course and we're working on how to create rules like:
>substitute an element of a list, find the last element of a list,
>concatenate two lists, membership test, etc. I'm just having problem with
>deletion of an element of the list, find an element in the list, and edit
>the list.
>
>Thanks for any suggestion or help.
>
>Alex
----
M i k e   C .   F l e t c h e r
http://itrc.uwaterloo.ca/%7Emcfletch/
Electronic Creator: CAD, Rendering, Information and Graphic Design

