Logtalk 2.29.4 files.
git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1800 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
15
Logtalk/examples/bottles/NOTES.txt
Normal file
15
Logtalk/examples/bottles/NOTES.txt
Normal file
@@ -0,0 +1,15 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.29.4
|
||||
|
||||
Copyright (c) 1998-2007 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
||||
|
||||
To load this example and for sample queries, please see the SCRIPT
|
||||
file.
|
||||
|
||||
This folder contains a Logtalk version of the programming problem
|
||||
"99 bottles of beer on the wall" , contributed to the web site:
|
||||
|
||||
http://99-bottles-of-beer.net/
|
13
Logtalk/examples/bottles/SCRIPT.txt
Normal file
13
Logtalk/examples/bottles/SCRIPT.txt
Normal file
@@ -0,0 +1,13 @@
|
||||
=================================================================
|
||||
Logtalk - Object oriented extension to Prolog
|
||||
Release 2.29.4
|
||||
|
||||
Copyright (c) 1998-2007 Paulo Moura. All Rights Reserved.
|
||||
=================================================================
|
||||
|
||||
|
||||
% just load the example, which contains an initialization/1 directive
|
||||
% that runs it:
|
||||
|
||||
| ?- logtalk_load(bottles(loader)).
|
||||
...
|
31
Logtalk/examples/bottles/bottles.lgt
Normal file
31
Logtalk/examples/bottles/bottles.lgt
Normal file
@@ -0,0 +1,31 @@
|
||||
/*******************************************************
|
||||
* 99 Bottles of Beer
|
||||
* Paulo Moura - January 21, 2007
|
||||
* bottles.lgt
|
||||
* To execute start Logtalk and use the query
|
||||
* logtalk_load(bottles).
|
||||
*******************************************************/
|
||||
|
||||
:- object(bottles).
|
||||
|
||||
:- initialization(sing(99)).
|
||||
|
||||
sing(0) :-
|
||||
write('No more bottles of beer on the wall, no more bottles of beer.'), nl,
|
||||
write('Go to the store and buy some more, 99 bottles of beer on the wall.'), nl, nl.
|
||||
sing(N) :-
|
||||
N > 0,
|
||||
N2 is N -1,
|
||||
beers(N), write(' of beer on the wall, '), beers(N), write(' of beer.'), nl,
|
||||
write('Take one down and pass it around, '), beers(N2), write(' of beer on the wall.'), nl, nl,
|
||||
sing(N2).
|
||||
|
||||
beers(0) :-
|
||||
write('no more bottles').
|
||||
beers(1) :-
|
||||
write('1 bottle').
|
||||
beers(N) :-
|
||||
N > 1,
|
||||
write(N), write(' bottles').
|
||||
|
||||
:- end_object.
|
11
Logtalk/examples/bottles/loader.lgt
Normal file
11
Logtalk/examples/bottles/loader.lgt
Normal file
@@ -0,0 +1,11 @@
|
||||
|
||||
:- initialization(
|
||||
logtalk_load(bottles)).
|
||||
|
||||
/*
|
||||
If you intend to use the FOP XSL:FO processor for generating PDF documenting
|
||||
files, comment the directive above and uncomment the directive below
|
||||
|
||||
:- initialization(
|
||||
logtalk_load(bottles, [events(on), xmlsref(standalone)])).
|
||||
*/
|
Reference in New Issue
Block a user