%	Insertion into binary tree and Warren's tree lookup program

insert(X, tree(_, X, _)) :- !.
insert(X, tree(Left, Y, _)) :-
	X < Y,
	!,
	insert(X, Left).
insert(X, tree(_, _, Right)) :- insert(X, Right).

lookup(Name, dic(Name, Value, _, _), Value) :- !.
lookup(Name, dic(Name1, _, Before, _), Value) :-
	Name < Name1,
	lookup(Name, Before, Value).
lookup(Name, dic(Name1, _, _, After), Value) :-
	Name > Name1,
	lookup(Name, After, Value).
