Thread View: comp.lang.prolog
7 messages
7 total messages
Started by nicholas
Tue, 23 Feb 1999 00:00
Urgently need help !!!!
Author: nicholas
Date: Tue, 23 Feb 1999 00:00
Date: Tue, 23 Feb 1999 00:00
27 lines
1483 bytes
1483 bytes
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. 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. 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). 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
Re: Urgently need help !!!!
Author: Matthew M. Huntbach
Date: Tue, 23 Feb 1999 00:00
Date: Tue, 23 Feb 1999 00:00
14 lines
1156 bytes
1156 bytes
nicholas (veryyong@mbox4.singnet.com.sg) wrote: > Please help me and e-mail me the answer for the above two questions. Thank > you in advanced. How would that help you? You were obviously set these (very simple) exercises because the best way of learning a many things, like how to program in a new programming language, is by DOING IT. If someone just told you the answers, you wouldn't have tackled this in the way your teacher meant you to have done, so you wouldn't have learnt by doing, so you will probably fail the exam at the end of the course. Matthew Huntbach
Re: Urgently need help !!!!
Author: tryppy
Date: Wed, 24 Feb 1999 00:00
Date: Wed, 24 Feb 1999 00:00
8 lines
804 bytes
804 bytes
Uni of London won't be very pleased with this ;-). -tryp 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!!
Re: Urgently need help !!!!
Author: 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
grupo latino
Author: tati
Date: Wed, 24 Feb 1999 00:00
Date: Wed, 24 Feb 1999 00:00
4 lines
719 bytes
719 bytes
por favor si alguien habla espa�ol y esta trabajando en prolog por favor me contesta gracias Nancy T.
Re: grupo latino
Author: Mike_Maxwell
Date: Thu, 25 Feb 1999 00:00
Date: Thu, 25 Feb 1999 00:00
14 lines
1213 bytes
1213 bytes
In article <01be600a$8b381340$33c488d0@default>,
"tati" <vidrhogar@cantv.net.ve> escribio:
> por favor si alguien habla espa�ol y esta trabajando en prolog por favor me
> contesta
> gracias
> Nancy T.
Que quiere preguntar?
Mike Maxwell
Mike_Maxwell@sil.org
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
Re: Urgently need help !!!!
Author: James M J Smith
Date: Thu, 18 Mar 1999 00:00
Date: Thu, 18 Mar 1999 00:00
44 lines
1889 bytes
1889 bytes
Dear Nicolas, I have sat down for only three or four minutes and have defined the predicates that answer all of the questions below. My conclusion is that they are all answerable. I hope that this help you. Regards, James M J Smith. 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. > >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. > >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). > >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 > >
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads