Tree member

Description

Source: The Art of Prolog

Download

Program source code: tree_member.pl

Listing

/*
	tree_member(Element,Tree):-
		Element is an element of the binary tree Tree
*/
	tree_member(X,tree(X,Left,Right)).
	tree_member(X,tree(Y,Left,Right)) :- tree_member(X,Left).
	tree_member(X,tree(Y,Left,Right)) :- tree_member(X,Right).
 
%	Program 3.24: Testing tree membership

Comments

pl/prolog/pllib/tree_member.txt · ostatnio zmienione: 2017/07/17 08:08 (edycja zewnętrzna)
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0