Skip to content

Commit

Permalink
=/=
Browse files Browse the repository at this point in the history
  • Loading branch information
zaoqi committed Sep 1, 2017
1 parent 8aaa61a commit 7f79768
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions prelude/unify.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,11 @@
(and xs ys (append xs ys))))]
[(vector? x) (and (vector? y) (unify cv (vector->list x) (vector->list y)))]
[(struct? x) (and (struct? y) (struct-type-eq? x y) (unify cv (struct->list x) (struct->list y)))]
[(hash? x) (and (hash? y) (unify cv (hash->list x) (hash->list y)))]
[else #f])))

#| ConstraintsV → Any → Any → Bool |#
(define (unify? cv x y) (null? (unify cv x y)))

#| Struct → Struct → Bool |#
(define (struct-type-eq? x y)
(let-values ([(tx _x) (struct-info x)] [(ty _y) (struct-info y)])
Expand Down Expand Up @@ -111,8 +113,8 @@
ncsvu
(let ([ns (set-filter (λ (y)
(let ([v2 (car y)] [z (cdr y)])
(if (equal? v v2)
(not (null? (unify csv x z)))
(if (unify? csv v v2)
(not (unify? csv x z))
#t))) s)])
(if (set-empty? ns)
#f
Expand Down

0 comments on commit 7f79768

Please sign in to comment.