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

11 lines
331 B
Prolog
Raw Permalink Normal View History

2020-01-24 15:18:10 +00:00
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).