From 02aae96912e771794ea5f606e79f646b22728d06 Mon Sep 17 00:00:00 2001 From: Matthew Butterick Date: Sun, 5 Oct 2014 11:53:18 -0700 Subject: [PATCH] nits --- csp/solver.rkt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/csp/solver.rkt b/csp/solver.rkt index 9f4f7779..3bd26804 100644 --- a/csp/solver.rkt +++ b/csp/solver.rkt @@ -54,7 +54,7 @@ null)) variable)) - (define (return-to-previous-variable) + (define (set!-previous-variable) (set!-values (variable values pushdomains) (pop-vvp-values! variable-queue)) (for-each-send pop-state pushdomains)) @@ -65,14 +65,14 @@ (yield (hash-copy possible-solution)) ; if there are no unassigned variables, solution is done. (if (null? variable-queue) ; if queue isn't empty, return to previous variable, otherwise all done. (exit-k) - (return-to-previous-variable))) + (set!-previous-variable))) (let value-checking-loop () ; we have a variable. Do we have any values left? (when (null? values) ; no, so try going back to last variable and getting some values (for/or ([i (in-naturals)]) (when (null? variable-queue) (exit-k)) ; no variables left, so solver is done (hash-remove! possible-solution variable) - (return-to-previous-variable) + (set!-previous-variable) (not (null? values)))) ;; Got a value. Check it.