This repository has been archived on 2023-04-04. You can view files and clone it, but cannot push or open issues or pull requests.
progra19/tut12/aufgabe1.pro
2020-01-24 16:18:10 +01:00

10 lines
331 B
Prolog

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).