Skip to content
Browse files

make PatternMatrix a record

  • Loading branch information...
1 parent 9c5faf9 commit 196016dd7197cbb4f6aa3ef45136c96fe60d678d @swannodette swannodette committed May 5, 2013
Showing with 7 additions and 16 deletions.
  1. +7 −16 src/main/clojure/clojure/core/match.clj
View
23 src/main/clojure/clojure/core/match.clj
@@ -695,13 +695,7 @@
(declare default-specialize-matrix)
-(deftype PatternMatrix [rows ocrs _meta]
- clojure.lang.IObj
- (meta [_] _meta)
-
- (withMeta [_ new-meta]
- (PatternMatrix. rows ocrs new-meta))
-
+(defrecord PatternMatrix [rows ocrs]
IPatternMatrix
(width [_] (if (not (empty? rows))
(count (rows 0))
@@ -779,13 +773,11 @@
(insert-row [_ i row]
(PatternMatrix. (into (conj (subvec rows 0 i) row) (subvec rows i))
- ocrs
- _meta))
+ ocrs))
(insert-rows [_ i rows]
(PatternMatrix. (into (into (subvec rows 0 i) rows) (subvec rows i))
- ocrs
- _meta))
+ ocrs))
(occurrences [_] ocrs)
@@ -794,18 +786,17 @@
IVecMod
(drop-nth [_ i]
- (PatternMatrix. (vec (map #(drop-nth % i) rows)) ocrs _meta))
+ (PatternMatrix. (vec (map #(drop-nth % i) rows)) ocrs))
;; Swap column number idx with the first column
(swap [_ idx]
(PatternMatrix. (vec (map #(swap % idx) rows))
- (swap ocrs idx)
- _meta)))
+ (swap ocrs idx))))
-(defn ^PatternMatrix pattern-matrix [rows ocrs]
+(defn pattern-matrix [rows ocrs]
{:pre [(vector rows)
(vector ocrs)]}
- (PatternMatrix. rows ocrs nil))
+ (PatternMatrix. rows ocrs))
(defn empty-matrix? [pm]
(= (dim pm) [0 0]))

0 comments on commit 196016d

Please sign in to comment.
Something went wrong with that request. Please try again.