Merge branch 'master' of xato:0517

This commit is contained in:
Vitor Santos Costa
2017-05-19 10:03:49 +01:00
200 changed files with 176828 additions and 432 deletions

View File

@@ -0,0 +1,22 @@
i = 5
def f(arg=i):
print arg
def multiply(a,b):
print "Will compute", a, "times", b
c = 0
for i in range(0, a):
c = c + b
return c
def square(a,b):
return [a*a,b*b]
def lsquare(a):
print a
b = []
for i in a:
b.append(i*i)
return b

View File

@@ -0,0 +1,10 @@
:- [library(python)].
main :-
:= import matplotlib.pyplot,
:= Plt = ematplotlib.pyplot,
Plt.plot([1,2,3,4]),
Plt.ylabel(`some numbers`),
Plt.show().

View File

@@ -0,0 +1,28 @@
:- 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).