Skip to content

Commit

Permalink
Tests for not construct, findall function and adding facts
Browse files Browse the repository at this point in the history
  • Loading branch information
czanalytics committed Jun 4, 2024
1 parent 247234a commit 8459dc7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
10 changes: 10 additions & 0 deletions lt/kb.pi
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,16 @@ cc(carrier3,3000,[slot1(4.5,1.5,loc(3,3,0)), slot2(4.5,1.5,loc(3,1,0)), slot3(5.
cc(carrier6,6000,[slot1(4.5,1.5,loc(3.3,0)), slot2(4.5,1.5,loc(3,1,0)), slot3(5.0,2.0,loc(5,1,3)),
slot4(4.5,1.5,loc(8,3,0)), slot5(4.5,1.5,loc(8,1,0)), slot6(5.0,2.0,loc(12,1,0))]).

% car(ShortestCar,Length1,_,_), \+ (car(_,Length2,_,_), Length2 < Length1). % options: \+ or not
% car(MaxL ,L1 ,_,_), not (car(_,L2 ,_,_), L2 > L1 ).

% L = findall(X,member(X,[1,2,3])) % [1,2,3]
% Foos = findall(foo(C,bar), member(C,[car1,car2,car3])). % [foo(car1,bar), ...]
% Slots = findall(S, slot(carrier3,S))

foo_facts =>
F = findall(foo(a,X,2), member(X, [1,2,3])), % [foo(a,1,2), foo(a,2,2), foo(a,3,2)]
Fs = $F, cl_facts(Fs, [$foo(+,-,-)]). % instantiation; testing foo(Bar,_,_)

side(Dx,Dy) = Mesh =>
St = new_array(Dx,Dy),
Expand Down
3 changes: 2 additions & 1 deletion lt/match.pi
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ main => println("Matching..."),
contour(Car2),
X0=1,Y0=1,tilt(Car2,X0,Y0,0),
X1=3,Y1=1,tilt(Car2,X1,Y1,10),
X2=1,Y2=4,tilt(Car2,X2,Y2,20).
X2=1,Y2=4,tilt(Car2,X2,Y2,20),
foo_facts.

%tilt(Car,1,2,10), tilt(Car2,2,2,20), tilt(Car2,1,1,30).

0 comments on commit 8459dc7

Please sign in to comment.