Category : Files from Magazines
Archive   : AIFIRST.ZIP
Filename : TURBO2.LTG

 
Output of file : TURBO2.LTG contained in archive : AIFIRST.ZIP


Turbo PROLOG:
Database Access Benchmark



/* Test database storage and retrieval by asserting lots of facts and looking
them up. */


DATABASE

fact(INTEGER)


PREDICATES

test(INTEGER)
test2(INTEGER, INTEGER)


CLAUSES

/* Tail recursively look up a numbered fact in the database and the assert
its successor. First argument is current fact number, second argument
is limiting fact number to stop at. */

test2(X,X).
test2(X,Y) :- fact(X), Z = X + 1, assert(fact(Z)), test2(Z,Y).

/* Shorthand predicate to default the test to start with fact(1). */

test(Y) :- test2(1,Y).

fact(1). /* Seed the database with the first fact */


GOAL

/* Prompt for the limiting fact number and run the benchmark. */

nl, write(ready), nl, readint(X), test(X), write(done), nl.



  3 Responses to “Category : Files from Magazines
Archive   : AIFIRST.ZIP
Filename : TURBO2.LTG

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/