Sophie

Sophie

distrib > Mandriva > 8.2 > i586 > media > contrib > by-pkgid > 8a80864b07c5f16e9ba9be320c149cfa > files > 52

teyjus-1.0_b31-15mdk.i586.rpm

 *****************************************************************************
 *                                                                           *
 *           ILLUSTRATION OF PROGRAM MANIPULATION USING TEYJUS               *
 *                                                                           *
 *  The script that follows shows the execution of the code that implements  *
 *  tail recursion recognition for arbitrary arity functional programs. The  *
 *  script is a little cryptic. Looking at the relevant module will reveal   *
 *  that the (tail recursive) factorial program of one and two arguments and *
 *  the gcd program are deemed to be tail recursive as expected but the      *
 *  append program is not so recognized. This code demonstrates the          *
 *  power/usefulness of higher-order unification.                            *
 *                                                                           *
 *  The module tr2_test is assumed to be precompiled in this script.         *
 *                                                                           *
 *****************************************************************************

(gopalan@Diligence 37)% tjsim -p examples/handbook/progs tr2_test
Welcome to Teyjus

Copyright (C) 1999 Gopalan Nadathur
Teyjus comes with ABSOLUTELY NO WARRANTY
This is free software, and you are welcome to redistribute it
under certain conditions.  Please view the accompanying file
"COPYING" for more information.
[tr2_test] ?- test 1.

yes

[tr2_test] ?- test 2.

yes

[tr2_test] ?- test 3.

no (more) solutions

[tr2_test] ?- test 4.

yes

[tr2_test] ?- stop.
(gopalan@Diligence 38)%