Logtalk 2.25.1 files.

git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1357 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
pmoura 2005-08-08 12:13:45 +00:00
parent ab97812ec7
commit 80c28e1507
219 changed files with 1380 additions and 1008 deletions

View File

@ -1,17 +1,23 @@
=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.25.0
Release 2.25.1
Copyright (c) 1998-2005 Paulo Moura. All Rights Reserved.
=================================================================
This file contains detailed instruction for installing and configuring
This file contains detailed instructions for installing and configuring
Logtalk. You should also consult the "scripts/NOTES" file for a description
of a set of shell scripts that might be used for Logtalk installation on
some operating-systems and for easy Logtalk integration with popular
Prolog compilers.
Note that the broad compatibility of Logtalk, both with Prolog compilers and
operating-systems, together with all the possible user scenarios, means that
installation can vary from very simple by running a couple of scripts to the
need of patching both Logtalk and Prolog compilers to workaround the lack of
strong Prolog standards.
1. LOGTALK INSTALLATION

View File

@ -1,6 +1,6 @@
=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.25.0
Release 2.25.1
Copyright (c) 1998-2005 Paulo Moura. All Rights Reserved.
=================================================================
@ -86,7 +86,7 @@ and other goodies when editing Logtalk source files.
application. You may want to add the directory path to the libpaths.pl file
mentioned above in order to easily load your application.
4. Copy to this sub-directory a loader file from one of the example directories
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.25.0
Release 2.25.1
Copyright (c) 1998-2005 Paulo Moura. All Rights Reserved.
=================================================================
@ -22,8 +22,8 @@ CONTENTS
1. LICENSE
The overall copyright and permission notice for Logtalk can be found in
the LICENSE file in this directory. Logtalk follows the Artistic License 2.0.
The overall copyright and permission notice for Logtalk can be found in the
LICENSE file in this directory. Logtalk follows the Artistic License 2.0.
The copyright notice and license applies to all files in this release
(including sources, documentation, and examples) unless otherwise explicitly
stated.

View File

@ -1,6 +1,6 @@
=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.25.0
Release 2.25.1
Copyright (c) 1998-2005 Paulo Moura. All Rights Reserved.
=================================================================
@ -10,6 +10,38 @@ RELEASE NOTES
=============
2.25.1 - August 8, 2005
Added support for using the "source-highlight" package (version 2.0 or
later) by Lorenzo Bettini with Logtalk source files.
Several optimizations to the syntax coloring configuration files of most
of the supported text editors. Added support for code folding to the Vim,
Kate, and TextMate text editors.
Updated the SWI-Prolog shell integration script (make_swilgt.sh) to use
either "swipl" or "pl" as the name of the Prolog executable, depending
on the host operating system.
Modified the way entity prefixes are generated for compiled code in order
to further minimize possible conflicts resulting from the same prefix being
used for different entities (bug report and fix by Brian Hulley). Changes
to the prefix format are also reflected on the names of the automatically
generated XML documenting files.
Updated the lgt2html.* and lgt2xml.* documenting scripts in order to index
parametric objects using the notation <entity>/<number of parameters>.
Corrected a bug on the lgtxml.xsl XSLT file where links to related files
pointed to .html files instead of .xml files.
Updated the lgt_install.sh and the make_*lgt.sh shell scripts to check and
report invalid installation directory prefixes.
Added a new state-space search problem, "salt3.lgt", contributed by Paula
Marisa Sampaio, to the "searching" example.
2.25.0 - May 23, 2005
Logtalk compiler is now source file-based instead of entity-based. Thus,

View File

@ -1,6 +1,6 @@
=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.25.0
Release 2.25.1
Copyright (c) 1998-2005 Paulo Moura. All Rights Reserved.
=================================================================
@ -9,15 +9,15 @@ Copyright (c) 1998-2005 Paulo Moura. All Rights Reserved.
Upgrading from Logtalk 1.x
==========================
Logtalk 2.x is not compatible with programs written for version 1.x.
Logtalk 2.x is not compatible with programs written for Logtalk 1.x.
However, you should be able to translate most programs to make them
run under this new version. Most of the examples provided with previous
versions have been rewritten to run under version 2.x. Use them as
run under Logtalk 2.x. Most of the examples provided with Logtalk 1.x
have been rewritten to run under Logtalk 2.x. You may use them as
translation examples.
Upgrading from a previous Logtalk 2.x version
=============================================
Upgrading from a previous Logtalk 2.x versions
==============================================
If your Logtalk programs depend on some of the example files, it is
advisable that you check your code against the new version before
@ -109,6 +109,12 @@ built-in methods, implying the recompilation of all objects, protocols, and
categories.
Logtalk version 2.25.0 drops support for source metafiles and .mlgt file name
extension as this version features a new, file-based compiler, supporting the
extension as this version features a new, file-based compiler supporting the
definition of any number of entities in a single file. Older code using source
metafiles will need to rename the file name extensions from .mlgt to .lgt.
Logtalk version 2.25.1 updates the compiler to generate XML documenting files
whose names always contain the arity of the entity identifier appended at the
end (using the format "_arity"). This change implied updates to the lgt2xml.*
and lgt2html.* shell scripts which render them incompatible with the XML files
generated by previous Logtalk versions.

View File

@ -1,6 +1,6 @@
=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.25.0
Release 2.25.1
Copyright (c) 1998-2005 Paulo Moura. All Rights Reserved.
=================================================================
@ -16,5 +16,5 @@ iso8601.lgt
are not yet implemented. The best way to get acquainted with
this library is for you to compile the object and then run
one of the documentation helper scripts to transform the
resulting XML file into a (X)HTML or PDF documentation. Your
resulting XML file into (X)HTML or PDF documentation. Your
feedback is appreciated.

View File

@ -1,6 +1,6 @@
=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.25.0
Release 2.25.1
Copyright (c) 1998-2005 Paulo Moura. All Rights Reserved.
=================================================================
@ -16,7 +16,7 @@ sample queries for your to try.
Most of these examples need objects, protocols, and categories which are
defined in the Logtalk standard library or in other examples. See the NOTES
files inside the library folder and the NOTES and SCRIPT files inside each
files inside the library folder, plus the NOTES and SCRIPT files inside each
example folder).
Some examples may redefine objects already loaded from other examples.
@ -47,19 +47,20 @@ assignvars
example of using assignable variables in the context of parametric objects
benchmarks
simple benchmarks for for helping measuring performance of Logtalk message
seding between Prolog compilers and for comparing message sending with
predicate calls in plain Prolog and with calls to modules predicates
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
(example adopted from the Adventure in Prolog Amzi! book)
bricks
example of representation and handling of relations using events
classvars
example of implementation of class variables (as found in Smalltalk)
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
@ -72,7 +73,7 @@ dynpred
example of using some of the built-in database handling methods
encodings
very simple example of using the new, experimental enconding/1
very simple example of using the new, experimental encoding/1
directive (requires Logtalk to be run with the SWI-Prolog compiler)
engines
@ -86,7 +87,7 @@ hello_world
the unavoidable hello world programming example
inheritance
examples of public, protected and private inheritance with both
examples of public, protected, and private inheritance using both
prototypes and classes/instances
instmethods
@ -96,8 +97,8 @@ lo
examples adopted from the Francis G. McCabe L&O system
logic
example of a translator of logic propositions to clauses in conjunctive
normal form
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
@ -151,8 +152,8 @@ roots
searching
state-space searching framework
example adopted from Ivan Bratko's "Prolog Programming for Artificial
Intelligence" book
(example adopted from Ivan Bratko's "Prolog Programming for Artificial
Intelligence" book)
shapes
geometric shapes implemented as both a prototype hierarchy and a class

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,6 @@
=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.25.0
Release 2.25.1
Copyright (c) 1998-2005 Paulo Moura. All Rights Reserved.
=================================================================
@ -10,7 +10,7 @@ To load this example and for sample queries, please see the SCRIPT file.
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
more accurate. In systems like Logtalk, which enables the use of explicit
metaclasses, true class variables are just the class (as an object) own
instance variables!

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -43,7 +43,7 @@ imported in two car models (sedan and coupe).
% from the standard one only in its reference and in its horsepower:
:- category(sport,
imports(classic)).
imports(classic)).
reference('M180.941').
horsepower_rpm(110, 5000).

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,6 @@
=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.25.0
Release 2.25.1
Copyright (c) 1998-2005 Paulo Moura. All Rights Reserved.
=================================================================
@ -12,7 +12,7 @@ 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
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.
@ -36,4 +36,4 @@ The two object hierarchies are organized as follows:
instance3
A second category named "interface", imported by all objects except the
sub-class instances, allows us to query the objercts about their interfaces.
sub-class instances, allows us to query the objects about their interfaces.

View File

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

View File

@ -1,22 +1,27 @@
/*
This category defines a predicate, interface/0, that prints an object
interface, i.e. predicate names and the corresponding scope properties.
We need to encapsulate the interface/0 predicate in a category instead
of just defining it in a root object in order to be able to list private
object predicates.
*/
:- category(interface).
:- public(interface/0).
:- mode(interface, one).
interface :-
forall(
(::current_predicate(Functor/Arity),
functor(Pred, Functor, Arity)),
(::predicate_property(Pred, Prop), scope_property(Prop),
(::predicate_property(Pred, Prop),
scope_property(Prop), % we are only interested on scope properties
writeq(Functor/Arity), write(' - '), writeq(Prop), nl)).
scope_property(public).
scope_property(protected).
scope_property(private).
:- end_category.

View File

@ -3,19 +3,5 @@
logtalk_load([
predicates,
interface,
parent,
prototype1,
prototype2,
prototype3,
descendant1,
descendant2,
descendant3,
root,
subclass1,
subclass2,
subclass3,
instance1,
instance2,
instance3])).
prototypes,
classes])).

View File

@ -1,7 +1,11 @@
/*
This category defines a set of predicates, which are imported by the
roots of both the class-based and the prototype-based hierarchies of
this example
*/
:- category(predicates).
:- public(public/0).
:- mode(public, one).
@ -11,15 +15,13 @@
:- private(private/0).
:- mode(private, one).
public :-
write('Public predicate declared and defined in category predicates.'), nl.
write('Public predicate declared and defined in category "predicates".'), nl.
protected :-
write('Protected predicate declared and defined in category predicates.'), nl.
write('Protected predicate declared and defined in category "predicates".'), nl.
private :-
write('Private predicate declared and defined in category predicates.'), nl.
write('Private predicate declared and defined in category "predicates".'), nl.
:- end_category.

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,6 @@
=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.25.0
Release 2.25.1
Copyright (c) 1998-2005 Paulo Moura. All Rights Reserved.
=================================================================
@ -10,9 +10,10 @@ To load this example and for sample queries, please see the SCRIPT
file.
This folder contains an object which implements a translator from
logic propositions to a set of clauses in conjunctive normal form.
The translator code is partially based on code published in the
book "Programming in Prolog" by W. F. Clocksin and C. S. Mellish.
first-order predicate logic propositions to conjunctive normal form
and to clausal form. The translator code is partially based on code
published in the book "Programming in Prolog" by W. F. Clocksin and
C. S. Mellish.
The following operators are used for representing logic connectives:

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,6 @@
=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.25.0
Release 2.25.1
Copyright (c) 1998-2005 Paulo Moura. All Rights Reserved.
=================================================================
@ -25,6 +25,7 @@ state-spaces and another for representing search methods:
state_space
farmer
water_jug
salt(Quantity, Measure1, Measure2)
heuristic_state_space
bridge
eight_puzzle

View File

@ -1,6 +1,6 @@
=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.25.0
Release 2.25.1
Copyright (c) 1998-2005 Paulo Moura. All Rights Reserved.
=================================================================
@ -199,6 +199,82 @@ Initial = (0,0) ?
yes
% salt puzzle using breadth first search
| ?- performance::init, salt(100, 500, 200)::initial_state(Initial), breadth_first(6)::solve(salt(100, 500, 200), Initial, Path), salt(100, 500, 200)::print_path(Path), performance::report.
(0, 0, 0) all_empty
(0, 500, 0) fill(m1)
(0, 300, 200) transfer(m1, m2)
(0, 300, 0) empty(m2)
(0, 100, 200) transfer(m1, m2)
(100, 0, 200) transfer(m1, acc)
solution length: 6
state transitions: 476
ratio solution length / state transitions: 0.0126050420168067
minimum branching degree: 1
average branching degree: 4.05829596412556
maximum branching degree: 6
time: 0.0899999999999999
Initial = 0, 0, 0, all_empty
Path = [(0, 0, 0, all_empty), (0, 500, 0, fill(m1)), (0, 300, 200, transfer(m1, m2)), (0, 300, 0, empty(m2)), (0, 100, 200, transfer(m1, m2)), (100, 0, 200, transfer(m1, acc))]
yes
| ?- performance::init, salt(200, 250, 550)::initial_state(Initial), breadth_first(7)::solve(salt(200, 250, 550), Initial, Path), salt(200, 250, 550)::print_path(Path), performance::report.
(0, 0, 0) all_empty
(0, 250, 0) fill(m1)
(0, 0, 250) transfer(m1, m2)
(0, 250, 250) fill(m1)
(0, 0, 500) transfer(m1, m2)
(0, 250, 500) fill(m1)
(0, 200, 550) transfer(m1, m2)
(200, 0, 550) transfer(m1, acc)
solution length: 8
state transitions: 3037
ratio solution length / state transitions: 0.00263417846559104
minimum branching degree: 1
average branching degree: 4.22404371584699
maximum branching degree: 6
time: 1.41
Initial = 0, 0, 0, all_empty
Path = [(0, 0, 0, all_empty), (0, 250, 0, fill(m1)), (0, 0, 250, transfer(m1, m2)), (0, 250, 250, fill(m1)), (0, 0, 500, transfer(m1, m2)), (0, 250, 500, fill(m1)), (0, 200, 550, transfer(m1, m2)), (200, 0, 550, transfer(m1, acc))]
yes
| ?- performance::init, salt(100, 250, 550)::initial_state(Initial), breadth_first(11)::solve(salt(100, 250, 550), Initial, Path), salt(100, 250, 550)::print_path(Path), performance::report.
(0, 0, 0) all_empty
(0, 0, 550) fill(m2)
(0, 250, 300) transfer(m2, m1)
(0, 0, 300) empty(m1)
(0, 250, 50) transfer(m2, m1)
(50, 250, 0) transfer(m2, acc)
(50, 0, 0) empty(m1)
(50, 0, 550) fill(m2)
(50, 250, 300) transfer(m2, m1)
(50, 0, 300) empty(m1)
(50, 250, 50) transfer(m2, m1)
(100, 250, 0) transfer(m2, acc)
solution length: 12
state transitions: 289904
ratio solution length / state transitions: 4.13930128594293e-5
minimum branching degree: 1
average branching degree: 4.50438946528332
maximum branching degree: 6
time: 1882.81
Initial = 0, 0, 0, all_empty
Path = [(0, 0, 0, all_empty), (0, 0, 550, fill(m2)), (0, 250, 300, transfer(m2, m1)), (0, 0, 300, empty(m1)), (0, 250, 50, transfer(m2, m1)), (50, 250, 0, transfer(m2, acc)), (50, 0, 0, empty(m1)), (50, 0, 550, fill(m2)), (50, 250, 300, transfer(m2, m1)), (50, 0, 300, empty(m1)), (50, 250, 50, transfer(m2, m1)), (100, 250, 0, transfer(m2, acc))]
yes
% eight puzzle solved using a hill-climbing strategy
| ?- performance::init, eight_puzzle::initial_state(five_steps, Initial), hill_climbing(25)::solve(eight_puzzle, Initial, Path, Cost), eight_puzzle::print_path(Path), performance::report.

View File

@ -3,6 +3,7 @@
logtalk_load([
state_space,
water_jug,
salt3,
farmer,
heuristic_state_space,
bridge,

View File

@ -0,0 +1,119 @@
/*
Salt state-space search problem
2003 Portuguese National Logical Programming Contest problem
http://paginas.fe.up.pt/~eol/LP/0304/documents/Exercicios_CNPL.PDF
Introduction:
Mr Silva sells salt. He has to measure the quantity requested by his
customers by using two measures and an accumulator. Neither has any
measuring markers. Those measures can easily be broken and he has to
replace them each time it happens. More, a substitution can be made
by a measure with a different capacity than the one being replaced.
Objective:
To produce a program, given the capacity of two measures and the
intended quantity, which helps Mr. Silva knowing if it is possible
to obtain the amount requested by his customer, and if so, measuring
the intended quantity in the least amount of steps.
Remarks:
This problem is similar to the Water Jug's' problem. It is more general,
seeing that the Water Jug's problem uses static values for the jugs
capacities and the final goal.
*/
:- object(salt(_acumulator, _measure1, _measure2),
instantiates(state_space)).
:- info([
version is 1.0,
author is 'Paula Marisa Sampaio',
date is 2005/06/08,
comment is 'Salt state-space search problem.']).
% each state is represented by a compound term with four arguments: (Acumulator, Measure1, Measure2, Step)
initial_state(initial, (0, 0, 0, all_empty)).
% the intended salt quantity must end up on the acumulator
goal_state(acumulator, (Acumulator, _, _, _)) :-
parameter(1, Acumulator).
% state transitions:
% emptying a measure into the accumulator
next_state((Acc, X, Y, _), (NewAcc, 0, Y, transfer(m1, acc))) :-
X > 0,
NewAcc is Acc + X.
next_state((Acc, X, Y, _), (NewAcc, X, 0, transfer(m2, acc))) :-
Y > 0,
NewAcc is Acc + Y.
% filling up of one of the measures
next_state((Acc, X, Y, Step), (Acc, MaxX, Y, fill(m1))) :-
parameter(2, MaxX),
X < MaxX,
Step \= empty(m1).
next_state((Acc, X, Y, Step), (Acc, X, MaxY, fill(m2))) :-
parameter(3, MaxY),
Y < MaxY,
Step \= empty(m2).
% either pouring of a measure into the other till it is filled up
% or all content of a measure into the other one
next_state((Acc, X, Y, _), (Acc, W, Z, transfer(m2, m1))) :-
parameter(2, MaxX),
Y > 0,
X < MaxX,
(X + Y >= MaxX ->
W = MaxX,
Z is Y - (MaxX - X)
;
W is X + Y,
Z = 0
).
next_state((Acc, X, Y, _), (Acc, W, Z, transfer(m1, m2))) :-
parameter(3, MaxY),
X > 0,
Y < MaxY,
(X + Y >= MaxY ->
W is X - (MaxY - Y),
Z = MaxY
;
W = 0,
Z is X + Y
).
% throwing out the contents of a measure; does not afect the accumulator
next_state((Acc, X, Y, Step), (Acc, 0, Y, empty(m1))) :-
X > 0,
Step \= fill(m1).
next_state((Acc, X, Y, Step), (Acc, X, 0, empty(m2))) :-
Y > 0,
Step \= fill(m2).
print_state((Acc, X, Y, Step)) :-
write('('), write((Acc, X, Y)), write(') '), write(Step), nl.
:- end_object.

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,6 @@
=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.25.0
Release 2.25.1
Copyright (c) 1998-2005 Paulo Moura. All Rights Reserved.
=================================================================
@ -20,8 +20,8 @@ requirements (for example, some Prolog compilers do not accept or expand
environment variables occurring on paths).
As defined, the provided "libpaths.pl" file is already compatible with some
of the most popular Prolog compilers, running on both Windows, Unix, and
Unix-like operating-systems.
of the most popular Prolog compilers, running on both MacOS X, Linux, Windows,
Unix, and Unix-like operating-systems.
The Prolog integration scripts found on the "scripts" directory generate
scripts and shortcuts that automatically load the copy of the "libpaths.pl"

View File

@ -2,7 +2,7 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Logtalk - Object oriented extension to Prolog
% Release 2.25.0
% Release 2.25.1
%
% Copyright (c) 1998-2005 Paulo Moura. All Rights Reserved.
%

View File

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

View File

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

View File

@ -1,7 +1,7 @@
=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.25.0
Release 2.25.1
Copyright (c) 1998-2005 Paulo Moura. All Rights Reserved.
=================================================================

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