% -*- prolog -*-

app([], Y, Y).
app([A|X], Y, [A|Z]) :- app(X, Y, Z).

mem(A, Z) :- app(_, [A|_], Z).

%%% association list:
myalist([[john, 3], [rachael, 4], [sam, 5], [joe, 4], [beth, 3]]).

%%% list ASSOC in scheme:
asso(Key, Val, Alist) :- mem([Key, Val], Alist).

app(W, X, Y, Z) :- app(W, X, WX), app(WX, Y, Z).
