Skip to content
Snippets Groups Projects
Verified Commit da223ba9 authored by Dominic Meiser's avatar Dominic Meiser
Browse files

tut12

parent 2aaea268
No related branches found
No related tags found
No related merge requests found
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).
squares(1, [1]).
squares(N, [NN,T2|R]) :- N > 1, T is N-1, squares(T, [T2|R]), NN is T2 + 2*T + 1.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment