sjl / temperance

A logic programming library for Common Lisp.
https://sjl.bitbucket.io/temperance
MIT License
58 stars 5 forks source link

Add arithmetic #11

Open sjl opened 8 years ago

sjl commented 8 years ago

Arithmetic operations on numbers would be good. We can lean heavily on Lisp, probably just need to implement is as a special form.

jsjolen commented 5 years ago

Are you sure that is is what you want?

Consider CLPFD:

https://www.metalevel.at/prolog/clpfd

https://github.com/triska/clpz

CLPFD is a form of constraint programming, and would ensure that your programs remain declarative.

This is what Screamer implements by the way: nikodemus.github.io/screamer/

If you'd choose to go this route then you could either:

  1. Write it in CL and expose the predicates themselves as black-box abstractions (all_distinct/1 is basically an impl. of bipartite matching for example).

  2. Write it in your fact language (but you'd have to have native support in the compiler to not have to resort to Peano arithmetic).

You're more familiar with the codebase so can probably see what would be the easiest.