2001-06-06 20:40:57 +01:00
|
|
|
=================================================================
|
|
|
|
Logtalk - Object oriented extension to Prolog
|
2004-09-30 21:28:42 +01:00
|
|
|
Release 2.21.1
|
2001-06-06 20:40:57 +01:00
|
|
|
|
2004-02-09 14:18:27 +00:00
|
|
|
Copyright (c) 1998-2004 Paulo Moura. All Rights Reserved.
|
2001-06-06 20:40:57 +01:00
|
|
|
=================================================================
|
|
|
|
|
|
|
|
|
2004-06-13 19:04:28 +01:00
|
|
|
% start by loading the example:
|
|
|
|
|
|
|
|
| ?- logtalk_load(loader).
|
|
|
|
...
|
|
|
|
|
|
|
|
|
2001-06-06 20:40:57 +01:00
|
|
|
% set a point in the space-time:
|
|
|
|
|
|
|
|
| ?- space_time::rotate(1, 2, 3).
|
|
|
|
yes
|
|
|
|
|
|
|
|
| ?- space_time::translate(4).
|
|
|
|
yes
|
|
|
|
|
|
|
|
|
|
|
|
% verify it:
|
|
|
|
|
|
|
|
| ?- space_time::xyzt(X, Y, Z, T).
|
|
|
|
|
|
|
|
T = 4,
|
|
|
|
X = 1,
|
|
|
|
Y = 2,
|
|
|
|
Z = 3 ?
|
|
|
|
yes
|
|
|
|
|
|
|
|
|
|
|
|
% enumerate space_time public predicates:
|
|
|
|
|
|
|
|
| ?- space_time::(current_predicate(Functor/Arity), functor(Pred, Functor, Arity), predicate_property(Pred, declared_in(Object))).
|
|
|
|
|
|
|
|
Pred = xyzt(_A,_B,_C,_D),
|
|
|
|
Arity = 4,
|
|
|
|
Object = space_time,
|
|
|
|
Functor = xyzt ? ;
|
|
|
|
|
|
|
|
Pred = xyz(_A,_B,_C),
|
|
|
|
Arity = 3,
|
|
|
|
Object = space,
|
|
|
|
Functor = xyz ? ;
|
|
|
|
|
|
|
|
Pred = rotate(_A,_B,_C),
|
|
|
|
Arity = 3,
|
|
|
|
Object = space,
|
|
|
|
Functor = rotate ? ;
|
|
|
|
|
|
|
|
Pred = t(_A),
|
|
|
|
Arity = 1,
|
|
|
|
Object = time,
|
|
|
|
Functor = t ? ;
|
|
|
|
|
|
|
|
Pred = translate(_A),
|
|
|
|
Arity = 1,
|
|
|
|
Object = time,
|
|
|
|
Functor = translate ? ;
|
|
|
|
|
|
|
|
no
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
% get the origin distance from a point in the space-time(_, _, _, _):
|
|
|
|
|
|
|
|
| ?- space_time(2,3,4,7)::distance(D).
|
|
|
|
|
|
|
|
D = 5.385164807134504 ?
|
|
|
|
yes
|
|
|
|
|
|
|
|
| ?- space_time(2,3,4,7)::time(T).
|
|
|
|
|
|
|
|
T = 7 ?
|
|
|
|
yes
|
|
|
|
|
|
|
|
|
|
|
|
% enumerate space_time(_, _, _, _) public predicates:
|
|
|
|
|
|
|
|
| ?- space_time(2,3,4,7)::(current_predicate(Functor/Arity), functor(Pred, Functor, Arity), predicate_property(Pred, declared_in(Object))).
|
|
|
|
|
|
|
|
Pred = distance(_A),
|
|
|
|
Arity = 1,
|
|
|
|
Object = space(_B,_C,_D),
|
|
|
|
Functor = distance ? ;
|
|
|
|
|
|
|
|
Pred = time(_A),
|
|
|
|
Arity = 1,
|
|
|
|
Object = time(_B),
|
|
|
|
Functor = time ? ;
|
|
|
|
|
|
|
|
no
|