mndrix / golog

Prolog interpreter in Go
MIT License
374 stars 39 forks source link

allow CanProve to exit early #15

Closed collosi closed 10 years ago

collosi commented 10 years ago

CanProve currently attempts to prove all, but then checks to see if there's at least one solution. This seems wasteful

mndrix commented 10 years ago

Thanks @laslowh. I added a test case and a little documentation before merging.

collosi commented 10 years ago

Looks great. Thanks. Hey, maybe you can answer this question for me. Can foreign predicates have side effects? Is it ok for a foreign predicate to return something different given the same arguments? Thanks.

graham

On Tue, Aug 19, 2014 at 4:12 PM, Michael Hendricks <notifications@github.com

wrote:

Thanks @laslowh https://github.com/laslowh. I added a test case and a little documentation before merging.

— Reply to this email directly or view it on GitHub https://github.com/mndrix/golog/pull/15#issuecomment-52691555.

mndrix commented 10 years ago

Can foreign predicates have side effects? Is it ok for a foreign predicate to return something different given the same arguments?

The answer to both questions is yes. Foreign predicates are welcome to use the full power of Go. If you create any foreign predicates that you think would be generally useful, feel free to submit pull requests. All the builtins (builtin.go) are implemented using the foreign predicate interface.