================================================================ Logtalk - Open source object-oriented logic programming language Release 2.30.2 Copyright (c) 1998-2007 Paulo Moura. All Rights Reserved. ================================================================ This folder contains several examples of Logtalk programs. A brief description of each example is included below. Each example folder contains a "NOTES.txt" file and a loader helper file that may be used to load all the example entities. In addition, most examples contain a "SCRIPT.txt" file with instructions on how to load the example and sample queries for your to try. Most of these examples need objects, protocols, and categories that are defined in the Logtalk standard library or in other examples. See the "NOTES.txt" files inside the library folder, plus the "NOTES.txt" and "SCRIPT.txt" files inside each example folder. Some examples may redefine objects already loaded from other examples. You may want to restart Logtalk after trying each example. Some of the examples have been adopted from public available Prolog code or from known Prolog text books and are copyrighted by the respective authors. These are programming examples, meaning that you should study the source files to fully understand them. However, note that some examples purpose is to illustrate general principles rather than being adequate, efficient solutions for deployment code. All examples are formatted using four spaces tabs. By default, compiling an example generates a XML documenting file for each compiled entity (object, category, or protocol). See the "xml" folder for instructions on how to browse the XML files for on-line reading or how to convert the files to a print-ready format such as PDF. Here is a short description of each included example: aliases example of using the alias/3 predicate directive to provide alternative names to inherited predicates in order to improve readability or to solve multi-inheritance conflicts assignvars example of using assignable variables in the context of parametric objects in order to represent object state benchmarks simple benchmarks for helping measuring performance of Logtalk message sending between Prolog compilers and for comparing performance of message sending calls with predicate calls in plain Prolog birds bird identification expert system (example adopted from the Adventure in Prolog Amzi! book) bottles 99 bottles of beer on the wall! Sing along! bricks example of representation and handling of relations using events; illustrates how to use events to avoid breaking object encapsulation classvars example of implementation of class variables (as found in Smalltalk; i.e. shared instance variables) dcgs examples of using DCG rules inside objects and categories diamonds examples of problems and solutions for the "diamond problem" (multi-inheritance conflicts and ambiguities) dynpred example of using some of the built-in database handling methods in order to implement dynamic object state encodings very simple example of using the new, experimental encoding/1 directive (requires Logtalk to be run with the SWI-Prolog compiler) engines example of category composition (importation of categories by other categories) using car engines errors example showing the Logtalk compiler warning and error reporting for common programming errors hello_world the unavoidable "hello world" programming example hooks simple example of using compiler hook objects and predicates inheritance examples of public, protected, and private inheritance using both prototypes and classes/instances instmethods example of instance defined methods; also illustrates the use of "super calls" to call overridden method definitions lo examples adopted from the Francis G. McCabe L&O system logic example of a translator of first-order predicate logic propositions to conjunctive normal form and to clausal form lpa examples adopted from the LPA Prolog++ system metapredicates example of using meta-predicates in Logtalk objects metainterpreters some examples of simple meta-interpreters defined as categories that can be imported by "database" objects mi simple multi-inheritance examples miscellaneous unsorted examples modules simple example of compiling Prolog module files as objects msglog example of using events and monitors for recording, replaying, and printing user messages operators example of using operators local to objects and categories parametric simple example of parametric objects poem examples adopted from the Ben Staveley-Taylor POEM system points example adopted from SICStus Objects documentation; defines a simple class hierarchy of points illustrating how to use categories as object components polygons example of representation and handling of relations using events profiling examples of using of events and monitors to implement profilers proxies example of using parametric object proxies for an efficient representation of objects with read-only state puzzles several examples of logical puzzles reflection example of a simple class-based reflective system relations objects implementing predicates for dealing with relations and constrained relations between objects; used by other examples roots objects, protocols, and categories needed by most of the other examples; illustrates how you can define object creation and abolishing methods, complete with initialization and termination options searching state-space searching framework (example adopted from Ivan Bratko's "Prolog Programming for Artificial Intelligence" book) shapes simple geometric shapes implemented as both a prototype hierarchy and a class hierarchy sicstus examples adopted from SICStus Objects documentation symdiff example of using parametric objects to implement symbolic expression differentiation and simplification tabling simple example of using tabling directives within objects threads several simple examples of multi-threading programming (requires Logtalk to be run with either YAP or SWI-Prolog) viewpoints example on how to implement property sharing and value sharing with prototypes