functional programs, was: Re: [Termtools] Next competition

Claude Marche marche at lri.fr
Thu Mar 16 12:00:05 CET 2006


>>>>> "Johannes" == Johannes Waldmann <waldmann at imn.htwk-leipzig.de> writes:

    >> ... on those examples that are outside the language that it can handle.

    Johannes> OK.

    Johannes> Of course what we need in the first place
    Johannes> are the examples themselves.

    Johannes> I guess you (Jürgen) have some? Who collects them? You? Claude?

I would be happy to include them in the TPDB as a new category

    Johannes> Also, the suggestion was to have a program and a start term.
    Johannes> What would be the syntax for giving this term?

    Johannes> ( How is it done for Prolog? At the moment I cannot access examples in
    Johannes> http://www.lri.fr/%7Emarche/tpdb/tpdb-2.0/LP/lpexamples/ )

Sorry about that, it seems the web server doesn't like .pl
files. (consider them as Perl files ???)

You can access them in the tar file.

Below is the ackermann.pl example. The query is given at the end of
the file.

- Claude

-- 
| Claude Marché           | mailto:Claude.Marche at lri.fr |
| LRI - Bât. 490          | http://www.lri.fr/~marche/  |
| Université de Paris-Sud | phoneto: +33 1 69 15 64 85  |
| F-91405 ORSAY Cedex     | faxto: +33 1 69 15 65 86    |


/* From Sterling and Shapiro; The Art of Prolog; Program 3.9
   

        ackermann(X,Y,A) :-
                A is the value of Ackermann's function for
                the natural numbers X and Y.
*/

        ackermann(0,N,s(N)).
        ackermann(s(M),0,Val) :- ackermann(M,s(0),Val).
        ackermann(s(M),s(N),Val) :-
                ackermann(s(M),N,Val1), ackermann(M,Val1,Val).


:- ackermann(i,o,i).

_______________________________________________
Termtools mailing list
Termtools at serveur-listes.lri.fr
http://serveur-listes.lri.fr/mailman/listinfo/termtools



More information about the Termtools mailing list