tut12
This commit is contained in:
parent
2aaea268fe
commit
da223ba91f
2 changed files with 12 additions and 0 deletions
10
tut12/aufgabe1.pro
Normal file
10
tut12/aufgabe1.pro
Normal 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
2
tut12/aufgabe7.pro
Normal 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.
|
Reference in a new issue