This commit is contained in:
Dominic 2020-01-24 16:18:10 +01:00
parent 2aaea268fe
commit da223ba91f
Signed by: msrd0
GPG key ID: DCC8C247452E98F9
2 changed files with 12 additions and 0 deletions

10
tut12/aufgabe1.pro Normal file
View file

@ -0,0 +1,10 @@
increment(leaf(X), leaf(s(X))).
increment(node(L, N, R), node(IncL, s(N), IncR)) :- increment(L, IncL),
increment(R, IncR).
myAppend([], YS, YS).
myAppend([X|XS], YS, [X|Res]) :- myAppend(XS, YS, Res).
inorder(leaf(X), [X]).
inorder(node(L, N, R), Res) :- inorder(L, LRes), inorder(R, RRes),
myAppend(LRes, [N|RRes], Res).

2
tut12/aufgabe7.pro Normal file
View file

@ -0,0 +1,2 @@
squares(1, [1]).
squares(N, [NN,T2|R]) :- N > 1, T is N-1, squares(T, [T2|R]), NN is T2 + 2*T + 1.