core.logic

membero should be updated to use disequality constraints

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

William Byrd considers the version of membero that appears in core.logic to be outdated and inferior to a version that uses disequality constraints. Full discussion here: http://youtu.be/MTAhbsWUUxM?t=1h20m00s

NEW version:

(defne membero
  "A relation where l is a collection, such that l contains x"
  [x l]
  ([_ [x . tail]])
  ([_ [head . tail]]
     (!= x head)       ;; The addition of this line is the only change.
     (membero x tail)))

(run* [q] (membero q [1 1 1])) 
;; => (1)
;; The current version returns (1 1 1).

Patch to follow.

Activity

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: