From bf1c4d1c98552caca33d3747fdb57bfa49aa2734 Mon Sep 17 00:00:00 2001 From: Matthew Butterick Date: Mon, 28 Dec 2020 12:38:40 -0800 Subject: [PATCH] use seteq sometimes --- csp/csp/hacs.rkt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/csp/csp/hacs.rkt b/csp/csp/hacs.rkt index be175117..893cbe05 100644 --- a/csp/csp/hacs.rkt +++ b/csp/csp/hacs.rkt @@ -77,7 +77,9 @@ (define/contract (make-var name [vals null]) ((name?) ((listof any/c)) . ->* . var?) - (var name (list->set vals))) + (var name (match vals + [(list (or (? fixnum?) (? symbol?)) ...) (list->seteq vals)] + [_ (list->set vals)]))) (define/contract (make-var-names prefix vals [suffix ""]) ((string? (listof any/c)) ((string?)) . ->* . (listof name?)) @@ -435,8 +437,8 @@ (when-debug (set! nfchecks (+ (length checked-vars) nchecks))) ;; conflict-set will be empty if there are no empty domains (as we would hope) (define conflict-set (for/list ([cvr (in-list checked-vars)] - #:when (set-empty? (domain cvr))) - (history cvr))) + #:when (set-empty? (domain cvr))) + (history cvr))) ;; for conflict-directed backjumping it's essential to forward-check ALL vars ;; (even after an empty domain is generated) and combine their conflicts ;; so we can discover the *most recent past var* that could be the culprit.