Category : Files from Magazines
Archive   : AIJUN87.ZIP
Filename : TOOL3.LTG

 
Output of file : TOOL3.LTG contained in archive : AIJUN87.ZIP

EXPERT TOOLBOX LISTING 3


/* Suppose our meningitis data base has a collection of data stored */
/* under the patients' last name. As a small example, say we are */
/* storing last and first names, hospital name, and admission date. */
/* Normally, we'd have something like: */

patient(thomas,jean,nyu,860512,_).
patient(jenkins,fred,st_lukes,850708,850918).
patient(jenkins,fred,nyu,870122,_).
patient(jenkins,fred,nyu,840910,841030).

/* To cut down search time and to keep the patients stored in order, */
/* we can record them in a B-tree called "patients." We use the */
/* predicate: recordb(Treename,Sortkey,Term). */

recordb(patients,thomas,patient(ahmed,jose,nyu,860512,_)).
recordb(patients,wu,patient(wu,sven,st_lukes,850708,850918)).
recordb(patients,runningdeer,patient(runningdeer,heinrich,nyu,870122,_)).
recordb(patients,oreilly,patient(oreilly,abdul,astoria,840910,841030)).

/* Now, we can search our B-tree. */
retrieveb(patients,X,Y). /* Returns a sorted list of all patients */
retrieveb(patients,wu,Y). /* Returns all the patients named 'wu' */

/* The 'removeb' predicate is used to delete entries from a B-tree. */

Note: This is an admittedly simple example. The intent is to show that
a good integration of data base facilities and PROLOG needn't add much
complication to the language. The predicates for manipulating data base
structures closely parallel standard PROLOG facilities for managing facts,
but yield a large increase in efficiency and flexibility.



  3 Responses to “Category : Files from Magazines
Archive   : AIJUN87.ZIP
Filename : TOOL3.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/