This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
yap-6.3/packages/python/examples/tests.yap
2017-05-19 10:03:49 +01:00

28 lines
513 B
Prolog

:- use_module(library(python)).
:- use_module(library(lists)).
main :-
test(I),
catch( dot(I), G, err(I,G) ),
writeln('.'),
fail.
main.
test(I) :-
findall(I, clause(det(I,_,_),_), IsF, Is0 ),
Is0 = [],
sort(IsF,Is),
member(I, Is).
dot(I) :-
det(I, Vs, Sol),
Vs == Sol.
err(I,N) :-
format(' test ~d failed with error: ~w',[I,N]).
det(a1,[X],[2]) :- X:=2.
det(a2,[],[]) :- x := range(1,10).
det(b2 [X],[9]) :- X := x.length().
det(c3,[X],[Y]) :- X:=cmath.sin(1), Y is sin(1).