Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Prolog greater_than\2

Status
Not open for further replies.

clapclash

Programmer
Jul 14, 2012
1
GB
Hi everyone I'm new to Prolog and I'm trying to complete an exercise on Learn Prolog Now, this is the exercise:
Defineapredicategreater_than/2thattakestwonumeralsintheno- tation that we introduced in this lecture (i.e. 0, succ(0), succ(succ(0)) ...) as arguments and decides whether the first one is greater than the second one. E.g:
?- greater_than(succ(succ(succ(0))),succ(0)).
yes
?- greater_than(succ(succ(0)),succ(succ(succ(0)))).
no

I've tried so many times to resolve it and now I'm stuck. Can anyone help me with this?
Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top