Newsgroups: comp.lang.prolog
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!news2.near.net!MathWorks.Com!news.kei.com!eff!usenet.ins.cwru.edu!agate!dog.ee.lbl.gov!ihnp4.ucsd.edu!munnari.oz.au!cs.mu.OZ.AU!munta.cs.mu.OZ.AU!lee
From: lee@munta.cs.mu.OZ.AU (Lee Naish)
Subject: Re: EQUAL question...
Message-ID: <9429011.9523@mulga.cs.mu.OZ.AU>
Sender: news@cs.mu.OZ.AU
Organization: Department of Computer Sci, University of Melbourne
References: <1994Oct11.141818@iowasp.physics.uiowa.edu> <37eu3a$p3l@elna.ethz.ch> <37g9kj$6rv@goanna.cs.rmit.oz.au>
Date: Mon, 17 Oct 1994 01:19:02 GMT
Lines: 13

In article <37g9kj$6rv@goanna.cs.rmit.oz.au> ok@goanna.cs.rmit.oz.au (Richard A. O'Keefe) writes:
>In article <1994Oct11.141818@iowasp.physics.uiowa.edu>
>banks@iowasp.physics.uiowa.edu writes:
>>/* I am trying to see if the 1st element of the list and the last
>>   element of the list are the same of a given list */
>
>    same_first_and_last([X|L]) :- append(_, [X], L).

In case you need to handle single element lists:

same_first_and_last([X|L]) :- append(_, [X], [X|L]).

	lee
