Example



next up previous WS Presentations Main Page
Next: Example Up: Document: ciao Previous: Example

Example

:- module(prod_cons,[p/1,q/1],cc(h)).

main :- q(X)& , p(X)& , X = [3|_].

p(X) :- ask((X=[N|T],N>0)) -> T=[_|_], p(T).
p(X) :- ask((X=[N|T],N=0)) -> T=[].

q(X) :- ask(X=[N,N1|T]) -> N1 is N-1, q([N1|T]).
q(X) :- ask(X=[0]).



Thu Jan 18 11:29:48 MET 1996 <herme@fi.upm.es>-<webmaster@clip.dia.fi.upm.es>