Skip to content

Commit 9d57fe0

Browse files
committed
up
1 parent 4218d60 commit 9d57fe0

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

examples/factorial-123.lisp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@
5353
(assert-equal (factorial-3 three) (mul three two))
5454
(assert-equal (factorial-3 four) (mul four (mul three two)))
5555

56+
(assert-not-same factorial-1 factorial-2)
57+
(assert-not-same factorial-1 factorial-3)
58+
(assert-not-same factorial-2 factorial-3)
59+
5660
(assert-equal factorial-1 factorial-2)
5761
(assert-equal factorial-1 factorial-3)
5862
(assert-equal factorial-2 factorial-3)

examples/fibonacci-123.lisp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@
6262
(assert-equal (fibonacci-3 four) three)
6363
(assert-equal (fibonacci-3 five) five)
6464

65+
(assert-not-same fibonacci-1 fibonacci-2)
66+
6567
;; TODO fail:
6668

6769
;; (assert-equal fibonacci-1 fibonacci-2)

src/lang/equal/equalInCtx.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,17 @@ const debug = false
1818
export function equalInCtx(ctx: Ctx, left: Value, right: Value): boolean {
1919
ctx = ctxDepthAdd1(ctx)
2020

21+
left = Values.lazyActiveDeep(left)
22+
right = Values.lazyActiveDeep(right)
23+
2124
if (debug) {
22-
console.log("[equalInCtx]", ctx.depth, "*", formatValue(left))
25+
console.log("[equalInCtx]", ctx.depth, " ", formatValue(left))
2326
console.log("[equalInCtx]", ctx.depth, "=", formatValue(right))
27+
console.log("[equalInCtx]", "same:", same(left, right))
2428
}
2529

2630
if (same(left, right)) return true
2731

28-
left = Values.lazyActiveDeep(left)
29-
right = Values.lazyActiveDeep(right)
30-
3132
if (left.kind === "NotYet" && right.kind === "NotYet") {
3233
return equalNeutralInCtx(ctx, left.neutral, right.neutral)
3334
}

0 commit comments

Comments
 (0)