Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Prolog

Name: Anonymous 2009-09-25 20:18

does anyone know anything about it?

Name: Anonymous 2009-09-25 20:32

No. No one.

Name: Anonymous 2009-09-25 20:36

I know that I will never be able to handle the sheer awesomeness of declarative languages.

Name: Anonymous 2009-09-25 20:42

Yes, what do you want to know?

Name: Anonymous 2009-09-25 20:53

Well, I hate to ask but I'm really fucking desperate right now.

Write a Prolog program named between so that between(I,J,K) is true iff K is an integer between I and J inclusive.

Name: Anonymous 2009-09-25 21:15

between(I,J,K) :- K >= I, K =< J ; K >= J, K =< I.

Name: Anonymous 2009-09-25 21:32

>>1
True

Name: Anonymous 2009-09-26 0:00

>>7
Master detected.

Name: Anonymous 2009-09-26 0:18

well i got that... I dont think my interpreter is working... could you guys check these out maybe?


2.  Write a Prolog program named min so that min(L,M) is true if M is the smallest element in the list L.

3. Write a Prolog program such that p(X) is true if X is a list consisting of n a's followed by n b's, for any n >= 1.

4. Write a Prolog program named mkset(Xs,Zs) which will be true if the list Zs is a list of the elements of Xs with any duplicates in Xs removed.  The list Zs is a set, so the elements of Xs in Zs should occur at most once.

5.  You are given the following Prolog predicates such as those below representing a database of countries and cities.

%country(name, population (in thousands), capital)
 country(sweden, 8823, stockholm).
 country(usa, 221000, washington).
 country(france, 56000, paris).
%  city(name, country, population).
city(lund, sweden,88).
city(paris,usa, 1)  %Paris, Texas

Give a Prolog predicate that will:
    a.  Answer those countries that have cities with the same name as capitals of other countries?
   b.  Answer those countries where more than 1/3 of the population lives in the queried city?

6. Write a Prolog predicate that extracts all numbers that are greater than and follow a given number in a list of numbers.  The empty list is returned if the number does not appear in the list, or the number is the only number in the list, or all elements in the list are less than the number.

Example:        Extractafter( 5, [5 3 5 6 7 5], Y)
                     Y= [6  7]

Name: Anonymous 2009-09-26 18:26

Oh, man, that's the most blatant "do my homework for me" thread I have ever seen.

Name: Anonymous 2010-11-14 3:26

Name: Anonymous 2010-11-25 11:48

Name: Anonymous 2011-02-03 1:15

Name: Anonymous 2011-02-04 19:22


Don't change these.
Name: Email:
Entire Thread Thread List