This project is great. I have been working on some examples and came across what I think may be an issue. I would like some feedback whether I'm wrong in my thinking...
predecessor( one, zero ).
predecessor( two, one ).
plus( two, zero, two ).
plus( two, one, three ).
plus( two, two, four ).
times( X, zero, zero ).
times( X, Y, Z ) :- predecessor( Y, Y1 ), times( X, Y1, P ), plus( X, P, Z ).
Y = [zero, one, two]
Z = [zero, two, four]
but only the first two answers appear.
This project is great. I have been working on some examples and came across what I think may be an issue. I would like some feedback whether I'm wrong in my thinking...
I have the following Prolog code:
I am issuing the query:
times( two, Y, Z )I was expecting to get:
but only the first two answers appear.
Any ideas why?
Stefan