Re: i am a prolog beginner pls help me in getting this



On 19 Apr 2007 10:42:44 +0300, Jussi Piitulainen
<jpiitula@xxxxxxxxxxxxxxxx> wrote:

jaya chandra writes:

i am asking bat everyother function man

Ok. But don't try to pass it on as your own work before
you actually understand it.

everyother(Every, Other) :-
starexpress(Every, Other, EveryOne, OtherOne),
everyotherone(EveryOne, OtherOne).

starexpress([], [], !, !).
starexpress([H], [I], H*!, I*!).
starexpress([H,I|T], [J|U], H*(I*V), J*W) :-
starexpress(T, U, V, W).

everyotherone(!, !).
everyotherone(F*R, F*S) :-
everyoneelse(R, S).

everyoneelse(!, !).
everyoneelse(_*R, S) :-
everyotherone(R, S).

Congratulations for doing his homework. Now we know that you are Real
Prolog Expert.

A.L.
.