|
25 | 25 | (defn dissoc-dom [x k]
|
26 | 26 | (assoc x :doms (dissoc (:doms x) k)))
|
27 | 27 |
|
| 28 | +(defn record? [x] |
| 29 | + (instance? clojure.lang.IRecord x)) |
| 30 | + |
28 | 31 | ;; =============================================================================
|
29 | 32 | ;; Marker Interfaces
|
30 | 33 |
|
|
1667 | 1670 |
|
1668 | 1671 | clojure.lang.IPersistentMap
|
1669 | 1672 | (walk-term [v f]
|
1670 |
| - (with-meta |
1671 |
| - ;; TODO: call empty here on v to preserve the type |
1672 |
| - ;; we were given, we can have the transient bit |
1673 |
| - ;; for the cases where we have a concrete Clojure map |
1674 |
| - ;; type, and just usy empty + assoc for everything else |
1675 |
| - (loop [v v r (transient {})] |
1676 |
| - (if (seq v) |
1677 |
| - (let [[vfk vfv] (first v)] |
1678 |
| - (recur (next v) (assoc! r (walk-term (f vfk) f) |
1679 |
| - (walk-term (f vfv) f)))) |
1680 |
| - (persistent! r))) |
1681 |
| - (meta v)))) |
| 1673 | + (if (record? v) |
| 1674 | + (walk-record-term v f) |
| 1675 | + (with-meta |
| 1676 | + ;; TODO: call empty here on v to preserve the type |
| 1677 | + ;; we were given, we can have the transient bit |
| 1678 | + ;; for the cases where we have a concrete Clojure map |
| 1679 | + ;; type, and just usy empty + assoc for everything else |
| 1680 | + (loop [v v r (transient {})] |
| 1681 | + (if (seq v) |
| 1682 | + (let [[vfk vfv] (first v)] |
| 1683 | + (recur (next v) (assoc! r (walk-term (f vfk) f) |
| 1684 | + (walk-term (f vfv) f)))) |
| 1685 | + (persistent! r))) |
| 1686 | + (meta v)))) |
| 1687 | + |
| 1688 | + clojure.lang.IRecord |
| 1689 | + (walk-term [v f] |
| 1690 | + (walk-record-term v f))) |
1682 | 1691 |
|
1683 | 1692 | ;; =============================================================================
|
1684 | 1693 | ;; Occurs Check Term
|
|
4029 | 4038 | nil))
|
4030 | 4039 |
|
4031 | 4040 | IUninitialized
|
4032 |
| - (-uninitialized [_] (PMap.)) |
4033 |
| - |
4034 |
| - IWalkTerm |
4035 |
| - (walk-term [v f] |
4036 |
| - (walk-record-term v f))) |
| 4041 | + (-uninitialized [_] (PMap.))) |
4037 | 4042 |
|
4038 | 4043 | (defn partial-map
|
4039 | 4044 | "Given map m, returns partial map that unifies with maps even if it
|
|
0 commit comments