File: SCRIPT

package info (click to toggle)
yap 5.1.1-3
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 16,124 kB
  • ctags: 14,650
  • sloc: ansic: 122,796; perl: 22,545; sh: 3,768; java: 1,277; makefile: 1,191; xml: 739; tcl: 624; lisp: 142; awk: 9
file content (95 lines) | stat: -rw-r--r-- 1,592 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
=================================================================
Logtalk - Object oriented extension to Prolog
Release 2.27.1

Copyright (c) 1998-2006 Paulo Moura.  All Rights Reserved.
=================================================================


% start by loading the example:

| ?- logtalk_load(mi(loader)).
...


% 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