Skip to content

Commit

Permalink
Merge pull request #1 from IUCompilerCourse/master
Browse files Browse the repository at this point in the history
  • Loading branch information
HalflingHelper authored Dec 9, 2024
2 parents 2fa6a9c + 68c2d51 commit 23a59e9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion interp-Ldyn.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
;; A copy of this interpreter is in the book and should be
;; kept in sync with this code.

(define (tagged-eq? v1 v2)
(match* (v1 v2)
[((Tagged v1 t1) (Tagged v2 t2)) (eq? v1 v2)]
[(v1 v2) (eq? v1 v2)]))

(define (interp-op op)
(match op
['+ fx+]
Expand Down Expand Up @@ -99,7 +104,7 @@
(match (Tagged-value (recur e1)) [#f (Tagged #t 'Boolean)]
[else (Tagged #f 'Boolean)])]
[(Prim 'eq? (list e1 e2))
(Tagged (equal? (recur e1) (recur e2)) 'Boolean)]
(Tagged (tagged-eq? (recur e1) (recur e2)) 'Boolean)]
[(Prim op (list e1))
#:when (set-member? type-predicates op)
(tag-value ((interp-op op) (Tagged-value (recur e1))))]
Expand Down

0 comments on commit 23a59e9

Please sign in to comment.