Skip to content

Commit 5832219

Browse files
committed
Moving to hamf protocols
1 parent a297578 commit 5832219

File tree

5 files changed

+18
-10
lines changed

5 files changed

+18
-10
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
# Changelog
2+
# 8.001
3+
* Moved to new hamf,dtype using the hamf protocols. See hamf's defprotocol namespace for reasons. If you are
4+
extending dataset protocols via extend, extend-type or extend-protocol you need to use defprotocol's drop-in
5+
replacements as opposed to clojure's default implementations.
6+
27
# 7.067
38
* :disable-na-as-missing for fixed types too
49
* new `maximum` reducer for reductions namespace

src/tech/v3/dataset/categorical.clj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
[tech.v3.datatype.errors :as errors]
1616
[tech.v3.datatype.bitmap :as bitmap]
1717
[ham-fisted.lazy-noncaching :as lznc]
18-
[ham-fisted.set :as set]))
18+
[ham-fisted.set :as set]
19+
[ham-fisted.defprotocol :refer [extend-type]])
20+
(:refer-clojure :exclude [extend-type]))
1921

2022

2123
(defn- indiscrete-mapping

src/tech/v3/dataset/math.clj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,14 @@
2121
[ham-fisted.set :as set]
2222
[ham-fisted.api :as hamf]
2323
[ham-fisted.function :as hamf-fn]
24+
[ham-fisted.defprotocol :refer [extend-type]]
2425
[clj-commons.primitive-math :as pmath]
2526
[clojure.tools.logging :as log]
2627
[clojure.set :as c-set])
2728
(:import [org.apache.commons.math3.analysis.interpolation LoessInterpolator]
2829
[tech.v3.datatype DoubleReader]
29-
[org.roaringbitmap RoaringBitmap]))
30+
[org.roaringbitmap RoaringBitmap])
31+
(:refer-clojure :exclude [extend-type]))
3032

3133
(set! *warn-on-reflection* true)
3234
(set! *unchecked-math* true)

src/tech/v3/dataset/neanderthal.clj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@
2525
[tech.v3.datatype.functional :as dfn]
2626
[tech.v3.tensor :as dtt]
2727
[tech.v3.parallel.for :as pfor]
28-
[clojure.tools.logging :as log]))
28+
[ham-fisted.defprotocol :refer [extend-type]]
29+
[clojure.tools.logging :as log])
30+
(:refer-clojure :exclude [extend-type]))
2931

3032

3133
(defn dataset->dense

src/tech/v3/dataset/protocols.clj

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
(ns tech.v3.dataset.protocols
22
(:require [tech.v3.datatype.protocols :as dtype-proto]
3-
[ham-fisted.protocols :as hamf-proto])
3+
[ham-fisted.protocols :as hamf-proto]
4+
[ham-fisted.defprotocol :refer [defprotocol extend-type extend-protocol]])
45
(:import [org.roaringbitmap RoaringBitmap]
56
[tech.v3.datatype Buffer]
67
[clojure.lang IDeref])
7-
(:refer-clojure :exclude [merge]))
8+
(:refer-clojure :exclude [merge defprotocol extend-type extend-protocol]))
89

910

1011
(defprotocol PRowCount
@@ -128,11 +129,7 @@
128129

129130
(extend-type Object
130131
PDatasetReducer
131-
(ds->reducer [this ds] this)
132-
(finalize-ds-reduced [this ctx]
133-
(if (instance? IDeref ctx)
134-
(.deref ^IDeref ctx)
135-
ctx)))
132+
(ds->reducer [this ds] this))
136133

137134
;;For large reductions we may want to combine reducers on a single column when
138135
;;possible.

0 commit comments

Comments
 (0)