removing duplicates from result - newbee
From: Antony Sequeira (usemyfullname_at_hotmail.com)
Date: 03/14/04
- Next message: Nick Wedd: "Re: Tree Height in Prolog"
- Previous message: pegalius: "Re: discovering predicate name"
- Next in thread: Nick Wedd: "Re: removing duplicates from result - newbee"
- Reply: Nick Wedd: "Re: removing duplicates from result - newbee"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sun, 14 Mar 2004 22:07:37 +0000
I am learning prolog using the prolog book(1986) by Bratko.
I consult the following code
conc([],L,L).
conc([X|L1],L2,[X|L3]) :-
conc(L1,L2,L3).
sublist(S,L) :-
conc(_,L2,L),
conc(S,_,L2).
I try
sublist(X,[a,b]).
I get the following results.
?- sublist(X,[a,b]).
X = [] ;
X = [a] ;
X = [a, b] ;
X = [] ;
X = [b] ;
X = []
Is it expected behavior to get the same result (the empty list) more
than once?
Is this too early for me to be asking this question(my prolog knowledge
is limited to the first three chapters of Bratko)?
I am using SWI-Prolog version 5.2.11 on Windows 2000.
Thanks,
-- Antony Sequeira use my full name at hotmail.com
- Next message: Nick Wedd: "Re: Tree Height in Prolog"
- Previous message: pegalius: "Re: discovering predicate name"
- Next in thread: Nick Wedd: "Re: removing duplicates from result - newbee"
- Reply: Nick Wedd: "Re: removing duplicates from result - newbee"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|