Newsgroups: comp.lang.prolog
Path: cantaloupe.srv.cs.cmu.edu!rochester!udel!news.mathworks.com!newsfeed.internetmci.com!swrinde!ihnp4.ucsd.edu!munnari.OZ.AU!cs.mu.OZ.AU!munta.cs.mu.OZ.AU!fjh
From: fjh@munta.cs.mu.OZ.AU (Fergus Henderson)
Subject: Re: Unexpected Uses for Common Predicates (was: help)
Message-ID: <9536517.19888@mulga.cs.mu.OZ.AU>
Sender: news@cs.mu.OZ.AU (CS-Usenet)
Organization: Computer Science, University of Melbourne, Australia
References: <4bqcfs$8h7@lantana.singnet.com.sg> <4bqukj$et4@cantua.canterbury.ac.nz> <1995Dec29.152128.1@leif>
Date: Sun, 31 Dec 1995 06:55:38 GMT
Lines: 23

jgarland@kean.ucs.mun.ca writes:

>> chiach@merlion.singnet.com.sg (Chia Chin Hiang) writes:
>>>Help, anybody knows how to extract the last item of a list using Prolog.
>>>Appreciate any hints or help.
[...]
>I think that this is a "trick" homework assignment where the object is to
>note that Prolog predicates can have multiple uses. Now that the semester 
>is likely over, here goes:
>
>Note that the call
>
>   append(Reduced_List,[Dropped_Item],Whole_list)
>
>results in the correct list.

Just a quick observation - this solution has the same efficiency
problem of leaving an unwanted choice point lying around as the
solution suggested in the other post that I followed up to in this thread.

--
Fergus Henderson             	WWW: http://www.cs.mu.oz.au/~fjh
fjh@cs.mu.oz.au              	PGP: finger fjh@128.250.37.3
