Subject: [SWIPL] HELP : IMPLEMENTATION

From: "Vaithan Param" <[email-masked]>
Date: Sat, 17 Nov 2001 06:05:12 +0000

I have a real hard time implementing  codes for these problems as I have 
just started working on prolog. Can anyone of u , figure it out for me ? 
Appreciate it.

allbutlast(X,L) if list X consists of all of list L except for its
last element.  allbutlast(X,[]) should fail.
Define allbutlast(X,L) (to find X given L).

allbutmaybelast(X,L) if X consists of all of list L except for its
last element if there is one.  (So allbutmaybelast([],[]) should
succeed).Define allbutmaybelast(X,L) (to find X given L).

threecopies(X,L) if list L consists of three copies of X appended
together.Define threecopies(X,L) (to find L given X).
For example the query threecopies([1,2],L) returns L=[1,2,1,2,1,2].

even(L) if list L has an even number of elements.
Define even(L).

threeappend(X,Y,Z,L)  if L is the result of appending the lists X,Y and
Z.Define threeappend(X,Y,Z,L).

Thanks a lot,

Vaithan

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp