Phase 7 followup: set equality in core-= + phs-to-struct

- phm.janet: add phs-to-struct (converts set to struct via phm-to-struct)
- core.janet: core-= now handles set? with phs-to-struct normalization
- test/phase7-test.janet: add (= #{1 2 3} #{3 2 1}) assertion
- 315 ok, 2 fail (pre-existing, unchanged)
This commit is contained in:
Yogthos 2026-06-02 23:29:58 -04:00
parent fe22fea3e4
commit 6c9e0c922d
3 changed files with 9 additions and 3 deletions

View file

@ -87,7 +87,10 @@
(set ok
(if (phm? a)
(deep= (phm-to-struct a) (if (phm? b) (phm-to-struct b) b))
(if (phm? b) (deep= a (phm-to-struct b)) (deep= a b)))))
(if (phm? b) (deep= a (phm-to-struct b))
(if (set? a)
(deep= (phs-to-struct a) (if (set? b) (phs-to-struct b) b))
(if (set? b) (deep= a (phs-to-struct b)) (deep= a b)))))))
(++ i))
ok)))

View file

@ -194,3 +194,6 @@
(defn phs-get [s x &opt default]
(default default nil)
(if (phm-contains? (s :phm) x) x default))
(defn phs-to-struct [s]
(phm-to-struct (s :phm)))