Article View: comp.lang.prolog
Article #4348Re: Urgently need help !!!!
From: tryppy
Date: Wed, 24 Feb 1999 00:00
Date: Wed, 24 Feb 1999 00:00
50 lines
2093 bytes
2093 bytes
Comments are within... nicholas wrote in message <7as4t8$cjs$1@mawar.singnet.com.sg>... >Hello everyone, I urgently need help on prolog programming in my coursework. >Please help me if possible!! > >The question is as below: > >1. Define a predicate int that takes three lists as arguments and return Yes >if and only if the first two lists have the same length and the third list >is the same as the first two interleaved. >For example, int ([1,2], [4,5], [1,4,2,5]) should return Yes. > Just concentrate on satisfying the main interleaving. Don't bother about the two lists having the same length as this will be an implicit understanding. The terminating condition should be xyz([],[],[]). >2. Explain how the predicate int, defined above, could be used to define a >predicate even that returns Yes if and only if its argument is a list with >even length. > Just link the even part directly to xyz. The interleaved part will have to be even, otherwise "no" will be displayed on your screen. >Define even in this manner and explain why the following does not correctly >define a predicate odd that returns Yes if and only if its argument is a >list of odd length: > >odd(X) :- not even(X). > This is not a fair test as it will not force X to be a list. This has to be done. >How could this be changed to correct the deficiencies. > >Please help me and e-mail me the answer for the above two questions. Thank >you in advanced. > >Best Regards, >Nicholas Enjoy... -tryp
Technical Details
Message-ID:
<7b081v$ujb$1@mawar.singnet.com.sg>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<7as4t8$cjs$1@mawar.singnet.com.sg>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f907c,3da97644542a4068 X-Google-Attributes: gidf907c,public X-Google-Thread: 1217ff,3da97644542a4068 X-Google-Attributes: gid1217ff,public From: "tryppy" <tryppy@mindless.com> Subject: Re: Urgently need help !!!! Date: 1999/02/24 Message-ID: <7b081v$ujb$1@mawar.singnet.com.sg> X-Deja-AN: 447792561 References: <7as4t8$cjs$1@mawar.singnet.com.sg> X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 Organization: Singapore Telecommunications Ltd Newsgroups: comp.lang.prolog,fj.lang.prolog