;; lib/minikanren/tests/zip-with-o.sx — element-wise combine of two lists.

(mk-test
  "zip-with-o-empty"
  (run* q (zip-with-o pluso-i (list) (list) q))
  (list (list)))

(mk-test
  "zip-with-o-pluso-i"
  (run*
    q
    (zip-with-o
      pluso-i
      (list 1 2 3)
      (list 10 20 30)
      q))
  (list (list 11 22 33)))

(mk-test
  "zip-with-o-times-i"
  (run*
    q
    (zip-with-o
      *o-i
      (list 2 3 4)
      (list 5 6 7)
      q))
  (list (list 10 18 28)))

(mk-test
  "zip-with-o-different-length-fails"
  (run*
    q
    (zip-with-o
      pluso-i
      (list 1 2)
      (list 1 2 3)
      q))
  (list))

(mk-test
  "zip-with-o-non-arith-rel"
  (run*
    q
    (zip-with-o
      (fn (a b r) (== r (list a b)))
      (list :x :y)
      (list 1 2)
      q))
  (list (list (list :x 1) (list :y 2))))

(mk-tests-run!)
