chickadee » mini-kanren » pluso

pluso n m kprocedure
+o n m kprocedure

A goal that unifies two logic variables n and m such that the bit-lists they represent sum to k when added. Think of this as if you were doing (define k (+ n m)), except that it is relational.


(run 1 (q)
  (let ((a (build-num 4))
        (b (build-num 3)))
    (fresh (n k)
      (== k a)
      (== n b)
      (pluso n q k))))
; => (1)