Hello Everyone!
I'm starting with core.logic, i'm trying to implement a simple relation
But the results are incomplete.
does anybody can help me to understand what I'm doing wrong here?
assuming core.logic aliased as l, and core.logic.fd :as fd
(defn zip+o [rel l1 l2 l3]
(conde
[(== () l1) (== () l2) (== () l3)]
[(fresh [fl1 rl1 fl2 rl2 fl3 rl3]
(l/conso fl1 rl1 l1)
(l/conso fl2 rl2 l2)
(fd/in fl1 fl2 fl3 (fd/interval 100))
(fd/+ fl1 fl2 fl3)
(zip+o rel rl1 rl2 rl3))]))
(run* [q]
(fresh [a b]
(== q [a b])
(zip+o a b [2 2])))
;=>
([(0 0) (2 2)]
[(1 0) (1 2)]
[(2 0) (0 2)])
but the result should be:
([(0 0) (2 2)]
[(1 0) (1 2)]
[(2 0) (0 2)]
[(0 1) (2 1)]
[(0 2) (2 0)]
[(1 1) (1 1)]
[(1 2) (1 0)]
[(2 1) (0 1)]
[(2 2) (0 0)])
In the other way it seems to work:
(run* [q]
(zip+o [1 1] [3 3] q))
;=> ((4 4))
--
You received this message because you are subscribed to the Google Groups
"minikanren" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/minikanren.
For more options, visit https://groups.google.com/d/optout.