core.logic

-merge-doms for ::nom is not closed under composition

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None

Description

(run* [q]
  (nom/fresh [a b c d]
    (fresh [x y z]
      (== (nom/tie a (nom/tie b y)) (nom/tie b (nom/tie a x)))
      (== (nom/tie c (nom/tie d x)) (nom/tie d (nom/tie c z)))
      (== x y)
      (== z x))))

The snippet above fails with a no implementation of method -merge-doms for LazySeq, because -merge-doms for ::nom is implemented for vectors but returns a lazy seq, not a vector.

The simplest fix is to change `concat` to `into` in the -merge-doms implementation of nominal.clj. However, while I am at it, I will replace the vector with a set, which makes more sense given how it's used anyways.

Patch will be attached shortly.

Activity

Hide
Nada Amin added a comment -

Patch logic-104.diff contains improved ::nom dom representation and test for this bug.

Show
Nada Amin added a comment - Patch logic-104.diff contains improved ::nom dom representation and test for this bug.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: