From ra27946@scs.ubbcluj.ro  Mon Dec 18 16:23:04 2000
Received: from Proxy2.UBBCluj.Ro (IDENT:root@Mail-Exchange.UBBCluj.ro [193.230.247.198])
	by swi.psy.uva.nl (8.9.3/8.9.3) with ESMTP id QAA17137
	for <prolog@swi.psy.uva.nl>; Mon, 18 Dec 2000 16:23:01 +0100 (MET)
Received: from Zeus.UBBCluj.Ro (IDENT:root@Zeus.UBBCluj.Ro [193.231.20.1])
	by Proxy2.UBBCluj.Ro (8.9.3/8.9.3) with ESMTP id RAA27072;
	Mon, 18 Dec 2000 17:22:05 +0200
Received: from Home.SCS.UBBCluj.Ro (IDENT:root@home.scs.ubbcluj.ro [193.231.20.38])
	by Zeus.UBBCluj.Ro (8.9.3/8.9.3) with ESMTP id RAA03936;
	Mon, 18 Dec 2000 17:20:52 +0200
Received: from Rave.SCS.UBBCluj.Ro (IDENT:ra27946@Rave.SCS.UBBCluj.Ro [193.231.20.39])
	by Home.SCS.UBBCluj.Ro (8.11.0/8.11.0) with ESMTP id eBIFKrb24685;
	Mon, 18 Dec 2000 17:20:53 +0200
Date: Mon, 18 Dec 2000 17:20:53 +0200 (EET)
From: Rastei Amelia Viorela  <ra27946@scs.ubbcluj.ro>
To: Nuno Baptista <i960242@dei.isep.ipp.pt>
cc: prolog@swi.psy.uva.nl
Subject: Re: [SWIPL] Prolog
In-Reply-To: <SAK.2000.12.18.jkntmalh@pci2a7>
Message-ID: <Pine.LNX.4.21.0012181718060.21185-100000@Rave.SCS.UBBCluj.Ro>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII

On Mon, 18 Dec 2000, Nuno Baptista wrote:

> I'm trying to find the algorithm to find if there are equal elements in to given lists. 

 Like L1=[4,3,5,4,2] is equal to L2=[3,2,4,5,4]??

> I could use some help in this task.
 If so this predicate will work:
  
  
 equal_lists([H1|T1],L2):- select(L2,H1,Res),equal_lists(T1,Res).
 equal_lists([],[]).        

Try on:

  ?- equal_lists([3,4,2,3,1],[2,1,3,3,4]).

  Yes
  ?- equal_lists([3,4,2,3,1],[2,1,3,4]).

  No

                       
> Thanks!!!






 You are welcome!  
> 
> Here is the code :
> 
> lista([],[],L):-!.
> lista([H1|T1],L,R):-
> 	member(H1,L),
> 	lista([H1|T1],L,[H1|R]).
> lista([H1|T1],[H2|T2],L):-
> 	lista(T1,T2,L).
> 
> Herege doesn't suffer from insanity. He enjoys every minute of it.
>                                        
>                                    *****HEREGE*****
> 
> 
> 
> ----------------
> * To UNSUBSCRIBE, please use the HTML form at
> 
>     http://www.swi.psy.uva.nl/projects/SWI-Prolog/index.html#mailinglist
> 
> or send mail to prolog-request@swi.psy.uva.nl using the Subject: "unsubscribe"
> (without the quotes) and *no* message body.
> 
> ** An ARCHIVE of this list is maintained at
> 
>     http://www.swi.psy.uva.nl/projects/SWI-Prolog/mailinglist/archive/
> 

-- 

 Amelia Rastei,
 Dept. Computer Science,
 Babes Bolyai University,
 Cluj Napoca, Romania. 

