Food chain

Description

Program use recursion to show food chain

Source: Learn prolog now!, 2001, (course available on-line)

Download

Program source code: food_chain.pl

Listing

is_digesting(X,Y) :- just_ate(X,Y).
is_digesting(X,Y) :-
	just_ate(X,Z),
	is_digesting(Z,Y).
 
just_ate(mosquito,blood(john)).
just_ate(frog,mosquito).
just_ate(stork,frog).

Comments

pl/prolog/pllib/food_chain.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