Logtalk 2.17.2 files.

git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1076 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
pmoura 2004-06-13 18:04:28 +00:00
parent 9543ecf436
commit d029e6c3fc
170 changed files with 2022 additions and 772 deletions

View File

@ -1,6 +1,6 @@
=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.17.1
Release 2.17.2
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
=================================================================
@ -46,14 +46,25 @@ variable named $LOGTALKHOME pointing to the Logtalk installation for use with
your Prolog compilers. If you use a csh shell, add the following line to your
~/.cshrc file:
setenv LOGTALKHOME "/your/installation/directory/lgt2171"
setenv LOGTALKHOME "/your/installation/directory/lgt2172"
If you use a bash shell, add the following lines to your ~/.profile file:
LOGTALKHOME="/your/installation/directory/lgt2171"
LOGTALKHOME="/your/installation/directory/lgt2172"
export LOGTALKHOME
When using the provided shell script for installing Logtalk, a symbolic link
to the Logtalk installation directory is automatically created. The link is
named "logtalk". In this case, use this symbolic link to define the
environment variable in order to avoid breaking it when upgrading Logtalk.
CREATING NEW PROLOG TOP-LEVELS FOR AUTOMATIC LOADING OF LOGTALK
Most Prolog compilers allows the user to define an initialization file that
is automatically consulted at startup. This initialization file may contain
directives for loading other files, such as the Logtalk configuration file
and the Logtalk compiler. The the "misc" sub-directory contains several shell
scripts for automating the creation of this initialization files for some
popular Prolog compilers. In addition, be sure to read the configs/NOTES file
notes on the Prolog compilers that you intend to use.

View File

@ -1,6 +1,6 @@
=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.17.1
Release 2.17.2
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
=================================================================
@ -16,7 +16,7 @@ Quick start
of the main Logtalk concepts.
3. Go back to the index.html file and select the User Manual link and then
the Installing and running Logtalk link. This will provide you with a basic
the Installing and running Logtalk links. This will provide you with a basic
understanding of how to start Logtalk and compile and load Logtalk code.
@ -27,48 +27,76 @@ or workaround is needed for your compiler.
2. Start your Prolog compiler.
3. Compile and load the config file for your Prolog compiler.
3. Change the current working directory of your Prolog session to the Logtalk
installation directory. If you don't know which predicate to use, check the
configs/NOTES file or your Prolog reference manual.
4. Compile and load the Logtalk pre-processor/runtime found in the compiler
4. Compile and load the config file for your Prolog compiler.
5. Compile and load the Logtalk pre-processor/runtime found in the compiler
sub-directory.
Note that both the configuration files and the compiler/preprocessor files
are Prolog files. The predicate called to load these files depends on your
Prolog compiler (consult your Prolog compiler documentation or take a look
at the definition of the predicate $lgt_load_prolog_code/1 in the config file.
at the definition of the predicate $lgt_load_prolog_code/1 in the config
file. For most command-line compilers, you could type at the Prolog prompt
something like:
| ?- ['configs/foo.config', 'compiler/logtalk.pl'].
Replace the file name foo.config with the appropriated config file name for
your compiler.
Now you can try some of the included examples:
Now you may try some of the included examples:
1. Open the examples sub-directory. There you find several sub-directories
with ready to run examples and a NOTES file containing a brief description
of each example. Select and open one of the examples sub-directory.
1. Change the working directory of your Prolog compiler to the library
directory and then type at the Prolog prompt the following query:
| ?- logtalk_load(all_loader).
This will load all the library entities that you will need in order to run
the Logtalk examples.
2. Open the examples sub-directory. There you find several sub-directories
with ready to run examples and a NOTES file containing general instructions
and a brief description of each example. Select and open one of the examples
sub-directory.
3. Read the example NOTES file. Some examples are dependent on other examples
or on library objects. You may need to load additional files before running
the chosen example.
or on library objects (already loaded on step one). You may need to load
additional files before running the chosen example.
4. Change the working directory of your Prolog compiler to the example
directory. If you don't know what predicate to use, check the configs/NOTES
file or your Prolog reference manual.
directory.
5. Compile and load the file named <example name>.loader. This will compile
and load all the example files. Note that the loader file is a Prolog file.
5. Compile and load the loader file for the example as described in the NOTES
and SCRIPT files. For most examples, the loader file is named loader.lgt.
Therefore, you will need to type the query:
6. Open the example SCRIPT file. One by one, copy-and-paste or drag-and-drop
the queries in the file to your Prolog top-level.
| ?- logtalk_load(loader).
7. Enjoy!
This will compile and load all the example files.
6. Open the example SCRIPT file, which contains sample queries that you
may try by copying-and-pasting or draging-and-droping them on your Prolog
interpreter top-level.
Ready to start writing your own programs?
1. Take a look at the wenv sub-directory. There you will find syntax
1. Read the User Manual sections on Programming in Logtalk and Running and
debugging Logtalk programs.
2. Take a look at the wenv sub-directory. There you will find syntax
configuration files for popular text editors that enable syntax coloring
when editing Logtalk source files.
2. Create a sub-directory with a suitable name to hold all the files of your
3. Create a sub-directory with a suitable name to hold all the files of your
application.
3. Copy to this sub-directory a *.loader file from one of the example
directories and modify it to load your own source files.
4. Copy to this sub-directory a loader file from one of the example directories
and modify it to load your own source files.
5. Have fun!

View File

@ -1,6 +1,6 @@
=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.17.1
Release 2.17.2
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
=================================================================
@ -8,15 +8,16 @@ Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
CONTENTS
1. License
2. Home of Logtalk package
3. Registration
4. Support
5. Installation
6. Documentation
7. Upgrading
8. Citations
9. Contributions
1. License
2. Home of Logtalk package
3. Registration
4. Support
5. Installation
6. Quick start
7. Documentation
8. Upgrading
9. Citations
10. Contributions
1. LICENSE
@ -83,11 +84,17 @@ for further instructions.
See the user manual for a description of the source files organization
and for using instructions (to read the user manual open the file
manuals/index.html with a web browser). Most files are formatted
using four-space tabs.
manuals/index.html with a web browser). Most files are formatted using
four-space tabs.
6. DOCUMENTATION
6. QUICK START
The file QUICK_START provides quick instructions for those of you in a hurry
to run Logtalk, provided that your favorite Prolog compiler is supported.
7. DOCUMENTATION
The reference and user manuals and the tutorial are provided in XHTML format
and are contained in the manuals directory.
@ -101,23 +108,20 @@ The file RELEASE_NOTES contains descriptions of the changes made in
Logtalk since the first public version. Read it carefully if you have
been using a previous Logtalk version.
The file QUICK_START provides quick instructions for those of you in a hurry
to run Logtalk, provided that your favorite Prolog compiler is supported.
7. UPGRADING
8. UPGRADING
If you have been using a previous Logtalk version read the file UPGRADING for
instructions on how to upgrade your programs to run under this new version.
8. CITATIONS
9. CITATIONS
If you want to cite Logtalk in your publications, please consult the file
BIBLIOGRAPHY for BibTeX references.
BIBLIOGRAPHY for BibTeX bibliographic references.
9. CONTRIBUTIONS
10. CONTRIBUTIONS
Contributions, constructive criticisms, code, and suggestions are always
welcome. If you want to contribute to this project, drop me a line to the

View File

@ -1,6 +1,6 @@
=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.17.1
Release 2.17.2
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
=================================================================
@ -10,6 +10,36 @@ RELEASE NOTES
=============
2.17.2 - June 14, 2004
Updated the Logtalk compiler to allow compilation of source files which
contain only directives and no entity definition.
Simplified loading of library and example entities by using Logtalk source
files as loader files.
Some improvements to the documentation, including the QUICK_START file and
the User Manual for first-time users, and to the example descriptions.
Corrected a bug in handling of local object operators that are also global
operators.
Corrected a bug where dynamic directives are not being generated for dynamic
predicates that lack a scope directive or an initial set of clauses.
Corrected a bug where local dynamic predicates would need a private scope
directive in order to allow clauses of the predicate to be retracted.
Simplified compilation of dynamic and discontiguous predicate directives.
Added new "logic" example implementing a translator from logic propositions
to conjunctive normal form.
Corrected a problem with wrong end-on-lines on some files.
Added a shell script for easy integration of Logtalk with CIAO Prolog.
2.17.1 - June 7, 2004
Added custom handling of specification of predicate exceptions in info/2

View File

@ -1,6 +1,6 @@
=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.17.1
Release 2.17.2
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
=================================================================

View File

@ -1,15 +1,22 @@
=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.17.1
Release 2.17.2
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
=================================================================
This folder contains several examples of Logtalk programs. Most of
these examples need objects, protocols, and categories that are
defined in the Logtalk standard library or in other examples, so
This folder contains several examples of Logtalk programs. A brief
description of each example is included below.
Each example contains a NOTES file and a loader utility file that may
be used to load all the example entities. In addtion, most examples
contain a SCRIPT file with 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, so
you should load them first (see the NOTES files inside the library
folder and inside each example folder).
folder and the NOTES file inside each example folder).
Some examples may redefine objects already loaded from other examples.
You may want to restart Logtalk after trying each example.
@ -42,7 +49,7 @@ classvars
example of implementation of class variables (as found in Smalltalk)
dcgs
example of using DCG rules inside objects and categories
examples of using DCG rules inside objects and categories
dynpred
example of using some of the built-in database handling methods
@ -60,6 +67,10 @@ instmethods
lo
examples adopted from the Francis G. McCabe L&O system
logic
example of a translator of logic propostions to clauses in conjunctive
normal form
lpa
examples adopted from the LPA Prolog++ system

View File

@ -1,17 +1,18 @@
=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.17.1
Release 2.17.2
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
=================================================================
To load all objects in this example consult the birds.loader utility
file.
To load all entities in this example compile and load the loader file:
You will also need to also load the library/hierarchies.loader file.
Note that the *.loader files are Prolog files. Alternatively, you may
load the library all.loader file to load all library entities.
| ?- logtalk_load(loader).
You will also need to also load the library/hierarchies_loader file.
Alternatively, you may load the library loader file to load all
library entities.
This folder contains an example of a bird identification expert system

View File

@ -1,11 +1,17 @@
=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.17.1
Release 2.17.2
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
=================================================================
% start by loading the example:
| ?- logtalk_load(loader).
...
% ask the expert system for help in identifying a bird:
| ?- expert::identify.

View File

@ -0,0 +1,42 @@
:- initialization(
logtalk_load([
descriptors,
order,
expert,
falconiforms, % orders
passerformes,
tubenose,
waterfowl,
albatross, % families
duck,
falcon,
flycatcher,
goose,
swallow,
swan,
vulture,
ash_throated_flycatcher, % birds
barn_swallow,
black_footed_albatross,
california_condor,
canada_goose,
cliff_swallow,
female_mallard,
fulmar,
great_crested_flycatcher,
laysan_albatross,
male_mallard,
peregrine_falcon,
pintail,
purple_martin,
snow_goose,
sparrow_hawk,
trumpeter_swan,
turkey_vulture,
whistling_swan])).

View File

@ -1,20 +1,20 @@
=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.17.1
Release 2.17.2
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
=================================================================
To load all objects in this example consult the bricks.loader utility
file (note that the *.loader files are Prolog files).
You will need to load the objects in the roots and relations
examples (consulting the corresponding roots.loader and relations.loader
files).
To load all entities in this example compile and load the loader file:
You will also need to consult the following files in the library directory:
events.loader, types.loader, metapredicates.loader, and hierarchies.loader.
Alternatively, you may load the library all.loader file to load all library
| ?- logtalk_load(loader).
You will need to load the objects in the roots and relations examples.
You will also need to load the following files in the library directory:
events_loader, types_loader, metapredicates_loader, and hierarchies_loader.
Alternatively, you may load the library all_loader file to load all library
entities.
This folder contains an example of representation and handling of
@ -25,5 +25,5 @@ moving a middle brick, we want to automatically destroy the
corresponding relation tuple.
It's instructive to use the event debugger in the Logtalk library (loader
file debugging.loader) to better understand this example. Set spy points
file debugging_loader.lgt) to better understand this example. Set spy points
in all brick instances and then activate the debugger.

View File

@ -1,11 +1,16 @@
=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.17.1
Release 2.17.2
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
=================================================================
% start by loading the example:
| ?- logtalk_load(loader).
...
% create four bricks, all standing on the "ground" (use your imagination... ;-)

View File

@ -0,0 +1,6 @@
:- initialization(
logtalk_load([
brick,
brick_stack,
stack_monitor])).

View File

@ -1,15 +1,22 @@
=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.17.1
Release 2.17.2
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
=================================================================
To load all objects in this example consult the classvars.loader utility
file (note that the *.loader files are Prolog files).
To load all entities in this example compile and load the loader file:
| ?- logtalk_load(loader).
This folder contains an example that shows how to implement class variables
as defined in Smalltalk. The name shared instance variables is however much
more accurate. In systems like Logtalk that enable the use of explicit
metaclasses, true class variables are just the class (as an object) own
instance variables!
This example defines a root class (root) and three instances (instance1,
instance2, and instance3). The root class defines a shared instance variable
(using a dynamic predicate) and the setter and getter methods which implement
the variable sharing behavior.

View File

@ -1,11 +1,17 @@
=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.17.1
Release 2.17.2
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
=================================================================
% start by loading the example:
| ?- logtalk_load(loader).
...
% get the value of the class variable for each instance:
| ?- instance1::cv(Value1), instance2::cv(Value2), instance3::cv(Value3).

View File

@ -0,0 +1,7 @@
:- initialization(
logtalk_load([
root,
instance1,
instance2,
instance3])).

View File

@ -1,13 +1,14 @@
=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.17.1
Release 2.17.2
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
=================================================================
To load all entities in this example consult the dcgs.loader
utility file (note that this is a Prolog file).
To load all entities in this example compile and load the loader file:
| ?- logtalk_load(loader).
This folder contains the following examples of using DCGs inside
objects and categories:

View File

@ -1,11 +1,17 @@
=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.17.1
Release 2.17.2
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
=================================================================
% start by loading the example:
| ?- logtalk_load(loader).
...
% DCG rules implementing a simple calculator:
| ?- calculator::parse("1+2-3*4", Result).

View File

@ -0,0 +1,16 @@
:- initialization(
logtalk_load([
parsep,
calculator,
parsetree,
determiners,
nouns,
verbs,
sentence,
url,
xml,
shell,
walker,
bom,
faa])).

View File

@ -1,13 +1,36 @@
=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.17.1
Release 2.17.2
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
=================================================================
To load all entities in this example consult the dynpred.loader
utility file (note that this is a Prolog file).
To load all entities in this example compile and load the loader file:
This folder contains examples of using some of the built-in database
handling methods.
| ?- logtalk_load(loader).
This folder contains examples of using some of the built-in database
handling methods. Two hierarchies are provided, one prototype-based,
and the other class-based, in order to illustrate the differences
between asserting predicates in a class and in a prototype.
The following objects are defined:
root
root of the protoype hierarchy; declares and defines a public,
dynamic predicate
descendant
simple prototype extending the root prototype
class
root of the class hierarchy; declares and defines a public predicate
metaclass
class metaclass
instance
simple instance of class class
prototype
simple prototype used to illustrate how the scope of asserted
predicates depends on the target object (this, self, or a explicit
object)

View File

@ -1,12 +1,18 @@
=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.17.1
Release 2.17.2
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
=================================================================
% Sending to descendant the message p/1, returns the definition in root:
% start by loading the example:
| ?- logtalk_load(loader).
...
% sending to descendant the message p/1, returns the definition in root:
| ?- descendant::p(Value).
@ -14,7 +20,7 @@ Value = root
yes
% Asserting a local definition for p/1 in descendant overrides the inherited
% asserting a local definition for p/1 in descendant overrides the inherited
% definition:
| ?- descendant::(assertz(p(descendant)), p(Value)).
@ -23,7 +29,7 @@ Value = descendant
yes
% If we retract the local definition, again the inherited definition form root
% if we retract the local definition, again the inherited definition form root
% will be used:
| ?- descendant::(retractall(p(_)), p(Value)).
@ -48,7 +54,7 @@ X = class
yes
% If we assert a clause for a new predicate, p2/1, in the class
% if we assert a clause for a new predicate, p2/1, in the class
% (a side-effect being a dynamic declaration of the predicate):
| ?- class::assertz(p2(class)).
@ -71,7 +77,7 @@ X = class
yes
% Using a prototype, assert three new predicates (the method object_assert/0
% using a prototype, assert three new predicates (the method object_assert/0
% asserts the predicate public_predicate/0 from outside the prototype; the
% method self_assert/0 asserts the predicate protected_predicate/0 in self;
% the method this_assert/0 asserts the predicate private_predicate/0 in this):

View File

@ -1 +1,6 @@
:- object(instance, instantiates(class)). :- end_object.
:- object(instance,
instantiates(class)).
:- end_object.

View File

@ -0,0 +1,9 @@
:- initialization(
logtalk_load([
root,
descendant,
metaclass,
class,
instance,
prototype])).

View File

@ -1,12 +1,17 @@
=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.17.1
Release 2.17.2
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
=================================================================
To load all entities in this example consult the warnings.loader and
the errors.loader utility files (note that these are Prolog files).
The entities on this example are divided in two sets. To load the two
sets of entities, compile and load the corresponding loader files:
| ?- logtalk_load(warnings_loader).
| ?- logtalk_load(errors_loader).
This folder contains examples of objects, categories, and protocols
containing errors that will trigger Logtalk compiler warnings and

View File

@ -0,0 +1,7 @@
:- object(ccredef).
::(_).
:- end_object.

View File

@ -0,0 +1,50 @@
:- initialization((
catch(
logtalk_load(
[lgtmthdredef],
[unknown(warning), misspelt(warning), singletons(warning), plredef(warning), lgtredef(warning), report(on)]),
_,
true),
catch(
logtalk_load(
[invclause],
[unknown(warning), misspelt(warning), singletons(warning), plredef(warning), lgtredef(warning), report(on)]),
_,
true),
catch(
logtalk_load(
[unknowndir],
[unknown(warning), misspelt(warning), singletons(warning), plredef(warning), lgtredef(warning), report(on)]),
_,
true),
catch(
logtalk_load(
[noninstdir],
[unknown(warning), misspelt(warning), singletons(warning), plredef(warning), lgtredef(warning), report(on)]),
_,
true),
catch(
logtalk_load(
[invargdir],
[unknown(warning), misspelt(warning), singletons(warning), plredef(warning), lgtredef(warning), report(on)]),
_,
true),
catch(
logtalk_load(
[unmatchdir],
[unknown(warning), misspelt(warning), singletons(warning), plredef(warning), lgtredef(warning), report(on)]),
_,
true),
catch(
logtalk_load(
[catdynpred],
[unknown(warning), misspelt(warning), singletons(warning), plredef(warning), lgtredef(warning), report(on)]),
_,
true),
catch(
logtalk_load(
[ccredef],
[unknown(warning), misspelt(warning), singletons(warning), plredef(warning), lgtredef(warning), report(on)]),
_,
true))).

View File

@ -1 +1,15 @@
:- object(portability). :- public(predicate/0). predicate :- compare(Result, first, second), retractall(result(Result, _)), sort([], []), consult(file). :- end_object.
:- object(portability).
:- public(predicate/0).
predicate :-
compare(Result, first, second),
retractall(result(Result, _)),
sort([], []),
consult(file).
:- end_object.

View File

@ -0,0 +1,5 @@
:- initialization(
logtalk_load(
[misspell, singletons1, plredef, lgtredef, unknownrefs, portability],
[unknown(warning), misspelt(warning), singletons(warning), plredef(warning), lgtredef(warning), portability(warning), report(on)])).

View File

@ -1,16 +1,41 @@
=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.17.1
Release 2.17.2
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
=================================================================
To load all objects in this example consult the inheritance.loader utility
file (note that the *.loader files are Prolog files).
This folder contains examples of public, protected and private inheritance,
for both prototypes and classes/instances. The category "predicates" defines
a set of three predicates, one public, one protected and one private. This
category is imported by the root objects: "parent" for the prototypes and
"root" for the classes/instances. Each root object have a set of three
To load all entities in this example compile and load the loader file:
| ?- logtalk_load(loader).
This folder contains examples of public, protected, and private inheritance,
for both prototype-based and class-based hierarchies.
This example defines a category named "predicates" which specifies three
predicates, one public, one protected and one private. This category is
imported by the root objects: "parent" for the prototype hierarchy and
"root" for the class hierarchy. Each root object have a set of three
descendants, each one using one of the inheritance types.
The two object hierarchies are organized as follows:
parent
prototype1 % public inheritance
descendant1
prototype2 % protected inheritance
descendant2
prototype3 % private inheritance
descendant3
root
subclass1 % public inheritance
instance1
subclass2 % protected inheritance
instance2
subclass3 % private inheritance
instance3
A second category named "interface", imported by all objects except the
sub-class instances, allows us to query the objercts about their interfaces.

View File

@ -1,11 +1,16 @@
=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.17.1
Release 2.17.2
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
=================================================================
% start by loading the example:
| ?- logtalk_load(loader).
...
% parent interface

View File

@ -0,0 +1,21 @@
:- initialization(
logtalk_load([
predicates,
interface,
parent,
prototype1,
prototype2,
prototype3,
descendant1,
descendant2,
descendant3,
root,
subclass1,
subclass2,
subclass3,
instance1,
instance2,
instance3])).

View File

@ -1,14 +1,30 @@
=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.17.1
Release 2.17.2
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
=================================================================
To load all objects in this example consult the instmethods.loader utility
file (note that the *.loader files are Prolog files).
To load all entities in this example compile and load the loader file:
| ?- logtalk_load(loader).
This folder contains an example of instance defined methods. When using
classes and instances, methods must be declared in a class but the method
definitions may be stored in the instances, either overriding or specializing
the class definitions.
This example defines the following objects:
root
root class defining a method named method/0
instance1
simple instance of root inheriting method/0
instance2
instance of root overriding the inherited method method/0
instance3
instance of root specializing the inherited method method/0

View File

@ -1,11 +1,17 @@
=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.17.1
Release 2.17.2
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
=================================================================
% start by loading the example:
| ?- logtalk_load(loader).
...
% instance1 definition for method "method" is found in its class:
| ?- instance1::method.

View File

@ -0,0 +1,7 @@
:- initialization(
logtalk_load([
root,
instance1,
instance2,
instance3])).

View File

@ -1,6 +1,6 @@
=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.17.1
Release 2.17.2
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
=================================================================

View File

@ -1,10 +1,12 @@
=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.17.1
Release 2.17.2
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
=================================================================
To load all objects in this library consult the planner.loader utility
file (note that the *.loader files are Prolog files).
To load all entities in this example compile and load the loader file:
| ?- logtalk_load(loader).

View File

@ -1,11 +1,17 @@
=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.17.1
Release 2.17.2
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
=================================================================
% start by loading the example:
| ?- logtalk_load(loader).
...
% plan a trip from london to the aiai conference in edinburgh:
| ?- plan(london)::from(imperial, aiai, L).

View File

@ -0,0 +1,21 @@
:- initialization(
logtalk_load([
plan1,
airport,
aberdeen_air,
city,
london,
albert_hall,
edinburgh,
edin,
aiai,
castle,
fly,
glasgow,
imperial,
lhr,
manchester,
renfrew,
ringway,
victoria])).

View File

@ -1,9 +1,11 @@
=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.17.1
Release 2.17.2
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
=================================================================
To load all objects in this library consult the travellers.loader utility
file (note that the *.loader files are Prolog files).
To load all entities in this example compile and load the loader file:
| ?- logtalk_load(loader).

View File

@ -1,11 +1,17 @@
=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.17.1
Release 2.17.2
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
=================================================================
% start by loading the example:
| ?- logtalk_load(loader).
...
% build a route by adding one town at a time:
| ?- incremental::route([london, brighton, portsmouth, exeter, oxford, aberystwyth], Route).

View File

@ -0,0 +1,47 @@
:- op(400, yfx, ~).
:- initialization(
logtalk_load([
quick1,
location2,
aberdeen,
aberystwyth,
birmingham,
brighton,
bristol,
cambridge,
cardiff,
carlisle,
dover,
edinburgh,
exeter,
glasgow,
hull,
leeds,
liverpool,
london,
manchester,
newcastle,
nottingham,
oxford,
penzance,
portsmouth,
sheffield,
swansea,
york,
salesman,
circular,
incremental,
presort,
driving,
geographic2,
metric1,
permute,
descend,
natural])).

View File

@ -1,20 +1,22 @@
=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.17.1
Release 2.17.2
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
=================================================================
To load all entities in this example compile and load the loader file:
| ?- logtalk_load(loader).
You will also need to load the library file hierarchies_loader.
Alternatively, you may load the library all_loader file to load all
library entities.
This example is an adaptation of a LPA Prolog++ example that is
described in the LPA Prolog++ Reference Manual. This manual can
be downloaded from the LPA web site <http://www.lpa.co.uk>. Please
consult this reference manual for further informations about this
example.
To load all objects in this example consult the lpa.loader utility
file.
You will also need to consult the library/hierarchies.loader file.
Note that the *.loader files are Prolog files. Alternatively, you
may load the library/all.loader file to load all library entities.

View File

@ -1,11 +1,17 @@
=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.17.1
Release 2.17.2
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
=================================================================
% start by loading the example:
| ?- logtalk_load(loader).
...
| ?- fault::findall.
Please answer all questions with yes or no.

View File

@ -0,0 +1,15 @@
:- initialization(
logtalk_load([
fault,
mechanical,
engine,
cylinders,
electrical,
starting,
sparking,
plugs,
distributor,
fuel_system,
lights,
starter_motor])).

View File

@ -1,12 +1,24 @@
=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.17.1
Release 2.17.2
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
=================================================================
To load all objects in this library consult the metainterpreters.loader utility
file.
This example contains simple meta-interpreters for pure Prolog encapsulated in
Logtalk objects.
To load all entities in this example compile and load the loader file:
| ?- logtalk_load(loader).
This example contains simple meta-interpreters for pure Prolog encapsulated
in Logtalk objects:
solver
simple meta-interpreter for pure Prolog
proof_tree
simple meta-interpreter for pure Prolog returning the proof tree
for successful queries
tracer
simple meta-interpreter for pure Prolog that traces proof construction

View File

@ -1,11 +1,17 @@
=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.17.1
Release 2.17.2
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
=================================================================
% start by loading the example:
| ?- logtalk_load(loader).
...
% solver - a simple meta-interpreter for pure Prolog:
| ?- solver::assertz(member_of(H, [H| _])).

View File

@ -0,0 +1,6 @@
:- initialization(
logtalk_load([
solver,
proof_tree,
tracer])).

View File

@ -1,18 +1,29 @@
=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.17.1
Release 2.17.2
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
=================================================================
To load all objects in this library consult the metapredicates.loader utility
file.
You will also need to load the library/types.loader file (note that the
*.loader files are Prolog files). Alternatively, you may load the
library/all.loader file to load all library entities.
To load all entities in this example compile and load the loader file:
| ?- logtalk_load(loader).
You will also need to load the library types_loader file. Alternatively,
you may load the library all_loader file to load all library entities.
This example shows the use of metapredicates in Logtalk. Metapredicates are
predicates whose head contains arguments that will be called as goals in the
body of the predicate definition.
This example defines two objects:
sort(_)
this is a parametric object containing a method that implements the
quicksort sorting algorithm; the parameter is interpreted as the type
of the elements being sorted
tracer
this object implements a metapredicate that is used by sort(_) to
trace the sorting algorithm steps

View File

@ -1,11 +1,17 @@
=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.17.1
Release 2.17.2
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
=================================================================
% start by loading the example:
| ?- logtalk_load(loader).
...
% note that "user" is a pseudo-object representing the Prolog database
% this implies that the integer comparisons are done using the standard
% Prolog built-in predicates

View File

@ -0,0 +1,5 @@
:- initialization(
logtalk_load([
tracer,
sort1])).

View File

@ -1,15 +1,41 @@
=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.17.1
Release 2.17.2
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
=================================================================
To load all objects in this example consult the mi.loader utility
file (note that the *.loader files are Prolog files).
To load all entities in this example compile and load the loader file:
| ?- logtalk_load(loader).
There are two examples in this folder. The first one is an adoption of a
multi-inheritance C++ example found on the D. M. Capper book "Introducing
C++ for Scientists, Engineers and Mathematicians" published by
Springer-Verlag. It uses dynamic predicates for storing state. The second
example is a variant of the first using parametric objects.
example is a variant of the first one using parametric objects.
This example defines the following objects:
space
this object space stores spatial coordinates using a dynamic
predicate
time
this object stores a time stamp using a dynamic predicate
space_time
this object inherits from both the objects space and time
space(_,_,_)
similar to object space but using parameters instead of dynamic
predicates
time(_)
similar to object space but using a parameter instead of a dynamic
predicate
space_time(_,_,_,_)
this object inherits from both the objects space(_,_,_) and time(_)

View File

@ -1,11 +1,17 @@
=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.17.1
Release 2.17.2
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
=================================================================
% start by loading the example:
| ?- logtalk_load(loader).
...
% set a point in the space-time:
| ?- space_time::rotate(1, 2, 3).

View File

@ -0,0 +1,10 @@
:- initialization(
logtalk_load([
space,
time,
space_time,
space3,
time1,
space_time4])).

View File

@ -1,16 +1,17 @@
=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.17.1
Release 2.17.2
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
=================================================================
To load all objects in this library consult the miscellaneous.loader utility
file (note that the *.loader files are Prolog files).
You will also need to load the library/types.loader file. Alternatively, you
may load the library/all.loader file to load all library entities.
To load all entities in this example compile and load the loader file:
| ?- logtalk_load(loader).
You will also need to load the library types_loader file. Alternatively, you
may load the library all_loader file to load all library entities.
hanoi.lgt
Towers of Hanoi example

View File

@ -1,11 +1,17 @@
=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.17.1
Release 2.17.2
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
=================================================================
% start by loading the example:
| ?- logtalk_load(loader).
...
% towers of hanoi using three disks:
| ?- hanoi::run(3).

View File

@ -0,0 +1,5 @@
:- initialization(
logtalk_load([
hanoi,
queens])).

View File

@ -1,12 +1,14 @@
=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.17.1
Release 2.17.2
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
=================================================================
To load all objects in this library consult the msglog.loader utility
file (note that the *.loader files are Prolog files).
To load all entities in this example compile and load the loader file:
| ?- logtalk_load(loader).
If you need more than one message recorder, just create a new prototype
as an extension of the object msglog.

View File

@ -1,10 +1,17 @@
=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.17.1
Release 2.17.2
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
=================================================================
% start by loading the example:
| ?- logtalk_load(loader).
...
% assume that all library entities have been loaded...
% start recording user messages:

View File

@ -0,0 +1,4 @@
:- initialization(
logtalk_load([
msglog])).

View File

@ -1,26 +1,25 @@
=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.17.1
Release 2.17.2
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
=================================================================
To load most objects in this example consult the operators.loader
utility file (note that the *.loader files are Prolog files).
This folder contains examples of the used of operators inside
objects and categories.
To load all entities in this example compile and load the loader file:
| ?- logtalk_load(loader).
This folder contains examples of the used of operators inside objects
and categories:
double.lgt
Simple object containing clauses using an infix operator.
triple.lgt
Simple object reading from a file, and asserting into self,
clauses that use an infix operator.
Simple object reading from a file (triple.txt), and asserting into
self, clauses that use an infix operator.
reverse.lgt
Simple object reading from a file, and writing to another
file, clauses that use infix operators.
Simple object reading from a file (next.txt), and writing to
another file (previous.txt), clauses that use infix operators.

View File

@ -1,11 +1,16 @@
=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.17.1
Release 2.17.2
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
=================================================================
% start by loading the example:
| ?- logtalk_load(loader).
...
% operators declared inside an object are not visible outside:

View File

@ -0,0 +1,6 @@
:- initialization(
logtalk_load([
double,
triple,
reverse])).

View File

@ -1,12 +1,14 @@
=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.17.1
Release 2.17.2
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
=================================================================
To load most objects in this example consult the parametric.loader
utility file (note that the *.loader files are Prolog files).
This folder contains two examples of parametric objects dealing
with time and date values.
To load all entities in this example compile and load the loader file:
| ?- logtalk_load(loader).
This folder contains two examples of parametric objects dealing with
time and date values.

View File

@ -1,11 +1,17 @@
=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.17.1
Release 2.17.2
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
=================================================================
% start by loading the example:
| ?- logtalk_load(loader).
...
% some queries using the time and date parametric objects:
| ?- date(Year, Month, Day)::today.

View File

@ -0,0 +1,5 @@
:- initialization(
logtalk_load([
date3,
time3])).

View File

@ -1,11 +1,12 @@
The example in this folder is an adpation of an example of POEM, an
object-oriented extension to Prolog developed by Ben Staveley-Taylor.
To load all objects in this example consult the poem.loader utility
file (note that the *.loader files are Prolog files).
To load all entities in this example compile and load the loader file:
Contrary to the other cases, to test this example consult the file
SCRIPT and then call the predicate run/0 to run the example.
| ?- logtalk_load(loader).
Contrary to the other cases, to test this example consult the Prolog
file SCRIPT and then call the predicate run/0 to run the example.
Original author contact:

View File

@ -0,0 +1,7 @@
:- initialization(
logtalk_load([
ellipse3,
circle2,
line2,
point2])).

View File

@ -1,21 +1,20 @@
=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.17.1
Release 2.17.2
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
=================================================================
To load all objects in this example consult the points.loader utility
file (note that the *.loader files are Prolog files).
To load all entities in this example compile and load the loader file:
You will need to load the objects in the roots and relations
examples (consulting the corresponding roots.loader and relations.loader
files).
| ?- logtalk_load(loader).
You will also need to consult the following files in the library directory:
events.loader, types.loader, metapredicates.loader, and hierarchies.loader.
Alternatively, you may load the library/all.loader file to load all library
You will need to load the objects in the roots and relations examples.
You will also need to load the following files in the library directory:
events_loader, types_loader, metapredicates_loader, and hierarchies_loader.
Alternatively, you may load the library all_loader file to load all library
entities.

View File

@ -1,11 +1,17 @@
=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.17.1
Release 2.17.2
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
=================================================================
% start by loading the example:
| ?- logtalk_load(loader).
...
% let's start with a simple point:
| ?- point::new(Point,[position-(1, 3)]), Point::(print, move(7, 4), print).

View File

@ -0,0 +1,9 @@
:- initialization(
logtalk_load([
point,
point_history,
bounded_coordinate,
bounded_point,
bounded_history_point,
history_point])).

View File

@ -1,20 +1,20 @@
=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.17.1
Release 2.17.2
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
=================================================================
To load all objects in this example consult the polygons.loader utility
file (note that the *.loader files are Prolog files).
You will need to load the objects in the roots and relations
examples (consulting the corresponding roots.loader and relations.loader
files).
To load all entities in this example compile and load the loader file:
| ?- logtalk_load(loader).
You will need to load the objects in the roots and relations examples.
You will also need to consult the following files in the library directory:
events.loader, types.loader, metapredicates.loader, and hierarchies.loader.
Alternatively, you may load the library/all.loader file to load all library
events_loader, types_loader, metapredicates_loader, and hierarchies_loader.
Alternatively, you may load the library all_loader file to load all library
entities.
In this example we have several types of polygons that can be concentric.

View File

@ -1,11 +1,17 @@
=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.17.1
Release 2.17.2
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
=================================================================
% start by loading the example:
| ?- logtalk_load(loader).
...
% first create four polygons and move each one to a different position
| ?- triangle::new(t, [position-(4, 5)]).

View File

@ -0,0 +1,9 @@
:- initialization(
logtalk_load([
concentric,
polygon,
hexagon,
pentagon,
square,
triangle])).

View File

@ -1,21 +1,35 @@
=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.17.1
Release 2.17.2
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
=================================================================
To load all objects in this example consult the profiling.loader utility
file.
To load all entities in this example compile and load the loader file:
| ?- logtalk_load(loader).
You will also need to load the following files in the library directory:
types.loader, events.loader, metapredicates.loader, and dates.loader (note
that the *.loader files are Prolog files). Alternatively, you may load the
library/all.loader file to load all library entities.
types_loader, events_loader, metapredicates_loader, and dates_loader.
Alternatively, you may simply load the library all_loader file to load all
library entities.
This is a very simple example of the use of events and monitors to make
profilers for an application. It's easy to modify to make it do much more.
For instance, most Prolog compilers give you access to data concerning space
usage (stacks, heap, etc).
The example defines three objects:
message_counter
using events, this object allows us to count the messages sent to
spied objects
stop_watch
using events, this object simply prints the cpu time before and after
a message sent to a spied object
timer
this object implements a method that sends a message to an object a
specified number of times, returning the average execution time

View File

@ -1,11 +1,17 @@
=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.17.1
Release 2.17.2
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
=================================================================
% start by loading the example:
| ?- logtalk_load(loader).
...
%% message_counter example

View File

@ -0,0 +1,6 @@
:- initialization(
logtalk_load([
timer,
message_counter,
stop_watch])).

View File

@ -1,13 +1,15 @@
=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.17.1
Release 2.17.2
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
=================================================================
To load all entities in this example consult the puzzles.loader
utility file (note that this is a Prolog file).
To load all entities in this example compile and load the loader file:
| ?- logtalk_load(loader).
This folder contains examples of Logtalk implementations for popular
logical puzzles.
logical puzzles. The description of each puzzle can be found on the
source files themselves.

View File

@ -1,11 +1,17 @@
=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.17.1
Release 2.17.2
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
=================================================================
% start by loading the example:
| ?- logtalk_load(loader).
...
% Harry Potter's room of potions logical puzzle:
| ?- potions::potions(P1, P2, P3, P4, P5, P6, P7).

View File

@ -41,21 +41,21 @@ Who owns the zebra and who drinks water?
argnames is ['Solution']]).
houses(Solution) :-
template(Solution), % 1
template(Solution), % 1
member(h(english, _, _, _, red), Solution), % 2
member(h(spanish, dog, _, _, _), Solution), % 3
member(h(_, _, _, coffee, green), Solution), % 4
member(h(ukrainian, _, _, tea, _), Solution), % 5
next(h(_, _, _, _, green), h(_, _, _, _, white), Solution), % 6
member(h(_, snake, winston, _, _), Solution), % 7
member(h(_, _, kool, _, yellow), Solution), % 8
next(h(_, _, _, _, green), h(_, _, _, _, white), Solution), % 6
member(h(_, snake, winston, _, _), Solution), % 7
member(h(_, _, kool, _, yellow), Solution), % 8
Solution = [_, _, h(_, _, _, milk, _), _, _], % 9
Solution = [h(norwegian, _, _, _, _)| _], % 10
next(h(_, fox, _, _, _), h(_, _, chesterfield, _, _), Solution), % 11
next(h(_, _, kool, _, _), h(_, horse, _, _, _), Solution), % 12
member(h(_, _, lucky, juice, _), Solution), % 13
next(h(_, _, kool, _, _), h(_, horse, _, _, _), Solution), % 12
member(h(_, _, lucky, juice, _), Solution), % 13
member(h(japonese, _, kent, _, _), Solution), % 14
next(h(norwegian, _, _, _, _), h(_, _, _, _, blue), Solution), % 15
next(h(norwegian, _, _, _, _), h(_, _, _, _, blue), Solution), % 15
member(h(_, _, _, water, _), Solution), % one of them drinks water
member(h(_, zebra, _, _, _), Solution). % one of them owns a zebra

View File

@ -0,0 +1,9 @@
:- initialization(
logtalk_load([
potions,
jam_thief,
horses,
houses,
note,
camp_swampy])).

View File

@ -1,3 +1,9 @@
/*
The description of this puzzle is easily found on the web. For example:
http://www.csci.csusb.edu/dick/cs320/prolog/Potions.htm
*/
:- object(potions).
@ -23,7 +29,7 @@
contents(H1),
list::select(P1, H1, H2),
list::select(P7, H2, H3),
P1 \= P7, P1 \= forward, P7 \= forward, % second clue
P1 \= P7, P1 \= forward, P7 \= forward, % second clue
list::select(P2, H3, H4),
P2 \= poison,
list::select(P3, H4, H5),

View File

@ -1,13 +1,16 @@
=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.17.1
Release 2.17.2
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
=================================================================
To load all objects in this example consult the reflection.loader utility
file (note that the *.loader files are Prolog files). Run this example with
no other examples loaded at the same time.
Run this example with no other examples loaded at the same time.
To load all entities in this example compile and load the loader file:
| ?- logtalk_load(loader).
This folder contains an example that shows how to implement a reflective
class-based system. There are three main classes:

View File

@ -1,11 +1,17 @@
=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.17.1
Release 2.17.2
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
=================================================================
% start by loading the example:
| ?- logtalk_load(loader).
...
% print the (public and protected) interface of each class:
| ?- (object, abstract_class, class)::print.

View File

@ -0,0 +1,6 @@
:- initialization(
logtalk_load([
class,
abstract_class,
object])).

View File

@ -1,12 +1,14 @@
=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.17.1
Release 2.17.2
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
=================================================================
To load all objects in this library consult the relations.loader utility
file (note that the *.loader files are Prolog files).
To load all entities in this example compile and load the loader file:
| ?- logtalk_load(loader).
You will also need to also load the objects in the roots example.

View File

@ -1,9 +1,15 @@
=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.17.1
Release 2.17.2
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
=================================================================
% start by loading the example:
| ?- logtalk_load(loader).
...
% the objects in this example are used by several of the other examples.

View File

@ -0,0 +1,6 @@
:- initialization(
logtalk_load([
relationp,
relation,
constrained_relation])).

View File

@ -1,18 +1,18 @@
=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.17.1
Release 2.17.2
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
=================================================================
To load all objects in this example consult the roots.loader utility
file (note that the *.loader files are Prolog files).
To load all entities in this example compile and load the loader file:
| ?- logtalk_load(loader).
You will need to consult the following files in the library directory:
events.loader, types.loader, and hierarchies.loader. Alternatively, you
may load the library/all.loader file to load all library entities.
events_loader, types_loader, and hierarchies_loader. Alternatively, you
may simply load the library all_loader file to load all library entities.
This folder contains rewritten versions of some of the objects provided
with previous, 1.x versions, of the Logtalk system. They are intended to
@ -20,3 +20,32 @@ help the conversion of applications from Logtalk 1.x to 2.x and to
support most of the other examples provided with the current Logtalk
package.
Short description of each example entity:
class
default metaclass for all classes
classp
protocol of class class
abstract_class
default metaclass for all abstract classes
abstract_classp
protocol of class abstract_class
object
root class for class-based hierarchies
objectp
protocol of class object
initialization
category defining methods for object initialization
proto
root prototype for prototype-based hierarchies
protop
protocol for prototype proto
nil
object used to represent a void reference
Please note that the entities above are just example definitions.

View File

@ -1,13 +1,18 @@
=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.17.1
Release 2.17.2
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
=================================================================
% some queries dealing with instance/class hierarchies:
% start by loading the example:
| ?- logtalk_load(loader).
...
% some queries dealing with instance/class hierarchies:
| ?- object::ancestors(Ancestors).

View File

@ -0,0 +1,8 @@
:- initialization(
logtalk_load([
initialization,
classp, class,
objectp, object,
abstract_classp, abstract_class,
nil])).

View File

@ -1,21 +1,46 @@
=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.17.1
Release 2.17.2
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
=================================================================
To load all objects in this example consult the searching.loader utility
file (note that the *.loader files are Prolog files).
To load all entities in this example compile and load the loader file:
| ?- logtalk_load(loader).
You will need to also load the objects in the roots example.
You will also need to load the following files in the library directory:
dates.loader, types.loader, events.loader, metapredicates.loader, and
hierarchies.loader. Alternatively, you can just load the all.loader file.
dates_loader, types_loader, events_loader, metapredicates_loader, and
hierarchies_loader. Alternatively, you can just load the library all_loader
file.
Some of the code in this folder is adopted from the book "Prolog Programming
for Artificial Intelligence" by Ivan Bratko.
For a description of the search problems, please see a classical AI book
(such as the one above) or visit the url <http://www.plastelina.net/games>.
This example defines two hierarchies of objects, one for representing
state-spaces and another for representing search methods:
state_space
farmer
water_jug
heuristic_state_space
bridge
eight_puzzle
miss_cann
search_strategy
blind_search(Bound)
breadth_first(Bound)
depth_first(Bound)
heuristic_search(Threshold)
best_first(Threshold)
hill_climbing(Threshold)
Taken together, these two hierarchies implement a framework for solving
state-space search problems in Logtalk.

View File

@ -1,11 +1,17 @@
=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.17.1
Release 2.17.2
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
=================================================================
% start by loading the example:
| ?- logtalk_load(loader).
...
% farmer, cabbage, goat and wolf problem
| ?- farmer::initial_state(Initial), depth_first(10)::solve(farmer, Initial, Path), farmer::print_path(Path).

View File

@ -0,0 +1,18 @@
:- initialization(
logtalk_load([
state_space,
water_jug,
farmer,
heuristic_state_space,
bridge,
eight_puzzle,
miss_cann,
search_strategy,
blind_search1,
breadth_first1,
depth_first1,
heuristic_search1,
best_first1,
hill_climbing1,
performance])).

View File

@ -1,6 +1,6 @@
=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.17.1
Release 2.17.2
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
=================================================================
@ -13,4 +13,13 @@ ph
prototype-based version
ch
class-based version
class-based version
Both versions define the following hierarchy of objects:
shape
polygon
regular_polygon
square
q1
q2

View File

@ -1,17 +1,18 @@
=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.17.1
Release 2.17.2
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
=================================================================
To load all objects in this example consult the ch.loader utility
file (note that the *.loader files are Prolog files).
To load all entities in this example compile and load the loader file:
You will need to also load the objects in the "roots" example.
| ?- logtalk_load(loader).
You will need to consult the following files in the library directory:
events.loader, types.loader, and hierarchies.loader. Alternatively, you
may load the library/all.loader file to load all library entities.
You will need to also load the objects in the roots example.
You will need to load the following files in the library directory:
events_loader, types_loader, and hierarchies_loader. Alternatively,
you may load the library all_loader file to load all library entities.

View File

@ -1,11 +1,20 @@
=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.17.1
Release 2.17.2
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
=================================================================
% start by loading the example:
| ?- logtalk_load(loader).
...
% try some simple queries:
| ?- square::nsides(N).
! error(

View File

@ -0,0 +1,9 @@
:- initialization(
logtalk_load([
shape,
polygon,
regular_polygon,
square,
q1,
q2])).

View File

@ -1,10 +1,11 @@
=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.17.1
Release 2.17.2
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
=================================================================
To load all objects in this example consult the ph.loader utility
file (note that the *.loader files are Prolog files).
To load all entities in this example compile and load the loader file:
| ?- logtalk_load(loader).

View File

@ -1,11 +1,20 @@
=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.17.1
Release 2.17.2
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
=================================================================
% start by loading the example:
| ?- logtalk_load(loader).
...
% try some simple queries:
| ?- square::nsides(N).
N = 4

View File

@ -0,0 +1,9 @@
:- initialization(
logtalk_load([
shape,
polygon,
regular_polygon,
square,
q1,
q2])).

View File

@ -1,16 +1,18 @@
=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.17.1
Release 2.17.2
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
=================================================================
The examples in this folder are adopted from the SICStus Prolog manual.
To load all objects in this example consult the sicstus.loader utility
file (note that the *.loader files are Prolog files).
To load all entities in this example compile and load the loader file:
| ?- logtalk_load(loader).
You will also need to load the following files in library directory:
hierarchies.loader and types.loader. Alternatively, you may load the
library/all.loader file to load all library entities.
hierarchies_loader and types_loader. Alternatively, you may load the
library all_loader file to load all library entities.

Some files were not shown because too many files have changed in this diff Show More