Preparing for second go at release.
This commit is contained in:
parent
7e95669ee7
commit
c6e85b5500
|
@ -7,7 +7,7 @@ Arbitrary numbers of dimensions are supported, up to limits imposed by the JVM s
|
|||
Available from Clojars: [](https://clojars.org/sparse-array)
|
||||
Tests currently [](https://circleci.com/gh/simon-brooke/sparse-array)
|
||||
|
||||
## Conventions:
|
||||
## Conventions
|
||||
|
||||
### Sparse arrays
|
||||
|
||||
|
|
|
@ -29,15 +29,15 @@
|
|||
style="width:11.45374449339207%;
|
||||
float:left;"> 26 </div></td>
|
||||
<td class="with-number">88.55 %</td>
|
||||
<td class="with-number">337</td><td class="with-number">23</td><td class="with-number">227</td>
|
||||
<td class="with-number">337</td><td class="with-number">22</td><td class="with-number">227</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="sparse_array/extract.clj.html">sparse-array.extract</a></td><td class="with-bar"><div class="covered"
|
||||
style="width:94.21965317919076%;
|
||||
float:left;"> 163 </div><div class="not-covered"
|
||||
style="width:5.780346820809249%;
|
||||
style="width:94.31818181818181%;
|
||||
float:left;"> 166 </div><div class="not-covered"
|
||||
style="width:5.681818181818182%;
|
||||
float:left;"> 10 </div></td>
|
||||
<td class="with-number">94.22 %</td>
|
||||
<td class="with-number">94.32 %</td>
|
||||
<td class="with-bar"><div class="covered"
|
||||
style="width:89.1304347826087%;
|
||||
float:left;"> 41 </div><div class="partial"
|
||||
|
@ -46,11 +46,11 @@
|
|||
style="width:8.695652173913043%;
|
||||
float:left;"> 4 </div></td>
|
||||
<td class="with-number">91.30 %</td>
|
||||
<td class="with-number">68</td><td class="with-number">5</td><td class="with-number">46</td>
|
||||
<td class="with-number">71</td><td class="with-number">5</td><td class="with-number">46</td>
|
||||
</tr>
|
||||
<tr><td>Totals:</td>
|
||||
<td class="with-bar"></td>
|
||||
<td class="with-number">86.68 %</td>
|
||||
<td class="with-number">86.72 %</td>
|
||||
<td class="with-bar"></td>
|
||||
<td class="with-number">89.01 %</td>
|
||||
</tr>
|
||||
|
|
|
@ -5,529 +5,529 @@
|
|||
</head>
|
||||
<body>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
001 (ns sparse-array.core)
|
||||
001 (ns sparse-array.core
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
002 "Operations on sparse arrays.")
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
002
|
||||
003
|
||||
</span><br/>
|
||||
<span class="covered" title="3 out of 3 forms covered">
|
||||
003 (declare put get)
|
||||
004 (declare put get)
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
004
|
||||
005
|
||||
</span><br/>
|
||||
<span class="covered" title="2 out of 2 forms covered">
|
||||
005 (def ^:dynamic *safe-sparse-operations*
|
||||
006 (def ^:dynamic *safe-sparse-operations*
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
006 "Whether spase array operations should be conducted safely, with careful
|
||||
007 "Whether spase array operations should be conducted safely, with careful
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
007 checking of data conventions and exceptions thrown if expectations are not
|
||||
008 checking of data conventions and exceptions thrown if expectations are not
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
008 met. Normally `false`."
|
||||
009 met. Normally `false`."
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
009 false)
|
||||
010 false)
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
010
|
||||
011
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
011 (defn- unsafe-sparse-operations?
|
||||
012 (defn- unsafe-sparse-operations?
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
012 "returns `true` if `*safe-sparse-operations*` is `false`, and vice versa."
|
||||
013 "returns `true` if `*safe-sparse-operations*` is `false`, and vice versa."
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
013 []
|
||||
014 []
|
||||
</span><br/>
|
||||
<span class="covered" title="5 out of 5 forms covered">
|
||||
014 (not (true? *safe-sparse-operations*)))
|
||||
015 (not (true? *safe-sparse-operations*)))
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
015
|
||||
016
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
016 (defn make-sparse-array
|
||||
017 (defn make-sparse-array
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
017 "Make a sparse array with these `dimensions`. Every member of `dimensions`
|
||||
018 "Make a sparse array with these `dimensions`. Every member of `dimensions`
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
018 must be a keyword; otherwise, `nil` will be returned."
|
||||
019 must be a keyword; otherwise, `nil` will be returned."
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
019 [& dimensions]
|
||||
020 [& dimensions]
|
||||
</span><br/>
|
||||
<span class="covered" title="2 out of 2 forms covered">
|
||||
020 (when
|
||||
021 (when
|
||||
</span><br/>
|
||||
<span class="partial" title="7 out of 8 forms covered">
|
||||
021 (and (pos? (count dimensions))
|
||||
022 (and (pos? (count dimensions))
|
||||
</span><br/>
|
||||
<span class="covered" title="3 out of 3 forms covered">
|
||||
022 (every? keyword? dimensions))
|
||||
023 (every? keyword? dimensions))
|
||||
</span><br/>
|
||||
<span class="covered" title="6 out of 6 forms covered">
|
||||
023 {:dimensions (count dimensions)
|
||||
024 {:dimensions (count dimensions)
|
||||
</span><br/>
|
||||
<span class="covered" title="3 out of 3 forms covered">
|
||||
024 :coord (first dimensions)
|
||||
025 :coord (first dimensions)
|
||||
</span><br/>
|
||||
<span class="covered" title="2 out of 2 forms covered">
|
||||
025 :content (if
|
||||
026 :content (if
|
||||
</span><br/>
|
||||
<span class="covered" title="5 out of 5 forms covered">
|
||||
026 (empty? (rest dimensions))
|
||||
027 (empty? (rest dimensions))
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
027 :data
|
||||
028 :data
|
||||
</span><br/>
|
||||
<span class="covered" title="3 out of 3 forms covered">
|
||||
028 (rest dimensions))}))
|
||||
029 (rest dimensions))}))
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
029
|
||||
030
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
030 (defn- safe-test-or-throw
|
||||
031 (defn- safe-test-or-throw
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
031 "If `v` is truthy or `*safe-sparse-operations*` is false, return `v`;
|
||||
032 "If `v` is truthy or `*safe-sparse-operations*` is false, return `v`;
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
032 otherwise, throw an `ExceptionInfo` with this `message` and the map `m`."
|
||||
033 otherwise, throw an `ExceptionInfo` with this `message` and the map `m`."
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
033 [v message m]
|
||||
034 [v message m]
|
||||
</span><br/>
|
||||
<span class="covered" title="3 out of 3 forms covered">
|
||||
034 (if-not
|
||||
035 (if-not
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
035 v
|
||||
036 v
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
036 (if
|
||||
037 (if
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
037 *safe-sparse-operations*
|
||||
038 *safe-sparse-operations*
|
||||
</span><br/>
|
||||
<span class="covered" title="5 out of 5 forms covered">
|
||||
038 (throw (ex-info message m))
|
||||
039 (throw (ex-info message m))
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
039 v)
|
||||
040 v)
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
040 v))
|
||||
041 v))
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
041
|
||||
042
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
042 (defn sparse-array?
|
||||
043 (defn sparse-array?
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
043 "`true` if `x` is a sparse array conforming to the conventions established
|
||||
044 "`true` if `x` is a sparse array conforming to the conventions established
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
044 by this library, else `false`."
|
||||
045 by this library, else `false`."
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
045 ;; TODO: sparse-array? should not throw exceptions even when
|
||||
046 ;; TODO: sparse-array? should not throw exceptions even when
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
046 ;; *safe-sparse-operations* is true, since we may use to test
|
||||
047 ;; *safe-sparse-operations* is true, since we may use to test
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
047 ;; whether an object is a sparse array. The place to throw the exceptions
|
||||
048 ;; whether an object is a sparse array. The place to throw the exceptions
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
048 ;; (if required) is after it has failed.
|
||||
049 ;; (if required) is after it has failed.
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
049 ([x]
|
||||
050 ([x]
|
||||
</span><br/>
|
||||
<span class="covered" title="2 out of 2 forms covered">
|
||||
050 (apply
|
||||
051 (apply
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
051 sparse-array?
|
||||
052 sparse-array?
|
||||
</span><br/>
|
||||
<span class="covered" title="2 out of 2 forms covered">
|
||||
052 (cons
|
||||
053 (cons
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
053 x
|
||||
054 x
|
||||
</span><br/>
|
||||
<span class="covered" title="2 out of 2 forms covered">
|
||||
054 (cons
|
||||
055 (cons
|
||||
</span><br/>
|
||||
<span class="covered" title="3 out of 3 forms covered">
|
||||
055 (:coord x)
|
||||
056 (:coord x)
|
||||
</span><br/>
|
||||
<span class="covered" title="2 out of 2 forms covered">
|
||||
056 (when
|
||||
057 (when
|
||||
</span><br/>
|
||||
<span class="covered" title="5 out of 5 forms covered">
|
||||
057 (coll? (:content x))
|
||||
058 (coll? (:content x))
|
||||
</span><br/>
|
||||
<span class="covered" title="3 out of 3 forms covered">
|
||||
058 (:content x))))))
|
||||
059 (:content x))))))
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
059 ([x & axes]
|
||||
060 ([x & axes]
|
||||
</span><br/>
|
||||
<span class="partial" title="16 out of 17 forms covered">
|
||||
060 (and
|
||||
061 (and
|
||||
</span><br/>
|
||||
<span class="covered" title="3 out of 3 forms covered">
|
||||
061 (safe-test-or-throw
|
||||
062 (safe-test-or-throw
|
||||
</span><br/>
|
||||
<span class="covered" title="3 out of 3 forms covered">
|
||||
062 (map? x)
|
||||
063 (map? x)
|
||||
</span><br/>
|
||||
<span class="covered" title="3 out of 3 forms covered">
|
||||
063 "Array must be a map" {:array x})
|
||||
064 "Array must be a map" {:array x})
|
||||
</span><br/>
|
||||
<span class="covered" title="2 out of 2 forms covered">
|
||||
064 (safe-test-or-throw
|
||||
065 (safe-test-or-throw
|
||||
</span><br/>
|
||||
<span class="covered" title="13 out of 13 forms covered">
|
||||
065 (and (integer? (:dimensions x)) (pos? (:dimensions x)))
|
||||
066 (and (integer? (:dimensions x)) (pos? (:dimensions x)))
|
||||
</span><br/>
|
||||
<span class="covered" title="6 out of 6 forms covered">
|
||||
066 (str "The value of `:dimensions` must be a positive integer, not " (:dimensions x))
|
||||
067 (str "The value of `:dimensions` must be a positive integer, not " (:dimensions x))
|
||||
</span><br/>
|
||||
<span class="covered" title="3 out of 3 forms covered">
|
||||
067 {:array x})
|
||||
068 {:array x})
|
||||
</span><br/>
|
||||
<span class="covered" title="2 out of 2 forms covered">
|
||||
068 (safe-test-or-throw
|
||||
069 (safe-test-or-throw
|
||||
</span><br/>
|
||||
<span class="covered" title="5 out of 5 forms covered">
|
||||
069 (keyword? (:coord x))
|
||||
070 (keyword? (:coord x))
|
||||
</span><br/>
|
||||
<span class="covered" title="6 out of 6 forms covered">
|
||||
070 (str "The value of `:coord` must be a keyword, not " (:coord x))
|
||||
071 (str "The value of `:coord` must be a keyword, not " (:coord x))
|
||||
</span><br/>
|
||||
<span class="covered" title="3 out of 3 forms covered">
|
||||
071 {:array x})
|
||||
072 {:array x})
|
||||
</span><br/>
|
||||
<span class="covered" title="2 out of 2 forms covered">
|
||||
072 (safe-test-or-throw
|
||||
073 (safe-test-or-throw
|
||||
</span><br/>
|
||||
<span class="covered" title="7 out of 7 forms covered">
|
||||
073 (= (:coord x) (first axes))
|
||||
074 (= (:coord x) (first axes))
|
||||
</span><br/>
|
||||
<span class="covered" title="10 out of 10 forms covered">
|
||||
074 (str "The value of `:coord` must be " (first axes) ", not " (:coord x))
|
||||
075 (str "The value of `:coord` must be " (first axes) ", not " (:coord x))
|
||||
</span><br/>
|
||||
<span class="covered" title="3 out of 3 forms covered">
|
||||
075 {:array x})
|
||||
076 {:array x})
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
076 (if
|
||||
077 (if
|
||||
</span><br/>
|
||||
<span class="covered" title="5 out of 5 forms covered">
|
||||
077 (empty? (rest axes))
|
||||
078 (empty? (rest axes))
|
||||
</span><br/>
|
||||
<span class="covered" title="3 out of 3 forms covered">
|
||||
078 (safe-test-or-throw
|
||||
079 (safe-test-or-throw
|
||||
</span><br/>
|
||||
<span class="covered" title="5 out of 5 forms covered">
|
||||
079 (= (:content x) :data)
|
||||
080 (= (:content x) :data)
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
080 "If there are no further axes the value of `:content` must be `:data`"
|
||||
081 "If there are no further axes the value of `:content` must be `:data`"
|
||||
</span><br/>
|
||||
<span class="covered" title="3 out of 3 forms covered">
|
||||
081 {:array x})
|
||||
082 {:array x})
|
||||
</span><br/>
|
||||
<span class="partial" title="4 out of 5 forms covered">
|
||||
082 (and
|
||||
083 (and
|
||||
</span><br/>
|
||||
<span class="covered" title="7 out of 7 forms covered">
|
||||
083 (= (:content x) (rest axes))
|
||||
084 (= (:content x) (rest axes))
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
084 (every?
|
||||
085 (every?
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
085 sparse-array?
|
||||
086 sparse-array?
|
||||
</span><br/>
|
||||
<span class="covered" title="12 out of 12 forms covered">
|
||||
086 (map #(x %) (filter integer? (keys x)))))))))
|
||||
087 (map #(x %) (filter integer? (keys x)))))))))
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
087
|
||||
088
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
088 (defn- unsafe-put
|
||||
089 (defn- unsafe-put
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
089 [array value coordinates]
|
||||
090 [array value coordinates]
|
||||
</span><br/>
|
||||
<span class="partial" title="1 out of 2 forms covered">
|
||||
090 (cond
|
||||
091 (cond
|
||||
</span><br/>
|
||||
<span class="covered" title="3 out of 3 forms covered">
|
||||
091 (every?
|
||||
092 (every?
|
||||
</span><br/>
|
||||
<span class="partial" title="14 out of 15 forms covered">
|
||||
092 #(and (integer? %) (or (zero? %) (pos? %)))
|
||||
093 #(and (integer? %) (or (zero? %) (pos? %)))
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
093 coordinates)
|
||||
094 coordinates)
|
||||
</span><br/>
|
||||
<span class="covered" title="2 out of 2 forms covered">
|
||||
094 (assoc
|
||||
095 (assoc
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
095 array
|
||||
096 array
|
||||
</span><br/>
|
||||
<span class="covered" title="3 out of 3 forms covered">
|
||||
096 (first coordinates)
|
||||
097 (first coordinates)
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
097 (if
|
||||
098 (if
|
||||
</span><br/>
|
||||
<span class="covered" title="5 out of 5 forms covered">
|
||||
098 (= :data (:content array))
|
||||
099 (= :data (:content array))
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
099 value
|
||||
100 value
|
||||
</span><br/>
|
||||
<span class="covered" title="2 out of 2 forms covered">
|
||||
100 (apply
|
||||
101 (apply
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
101 put
|
||||
102 put
|
||||
</span><br/>
|
||||
<span class="covered" title="2 out of 2 forms covered">
|
||||
102 (cons
|
||||
103 (cons
|
||||
</span><br/>
|
||||
<span class="partial" title="4 out of 5 forms covered">
|
||||
103 (or
|
||||
104 (or
|
||||
</span><br/>
|
||||
<span class="covered" title="5 out of 5 forms covered">
|
||||
104 (array (first coordinates))
|
||||
105 (array (first coordinates))
|
||||
</span><br/>
|
||||
<span class="covered" title="5 out of 5 forms covered">
|
||||
105 (apply make-sparse-array (:content array)))
|
||||
106 (apply make-sparse-array (:content array)))
|
||||
</span><br/>
|
||||
<span class="covered" title="6 out of 6 forms covered">
|
||||
106 (cons value (rest coordinates))))))))
|
||||
107 (cons value (rest coordinates))))))))
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
107
|
||||
108
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
108 (defn put
|
||||
109 (defn put
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
109 "Return a sparse array like this `array` but with this `value` at these
|
||||
110 "Return a sparse array like this `array` but with this `value` at these
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
110 `coordinates`. Returns `nil` if any coordinate is invalid."
|
||||
111 `coordinates`. Returns `nil` if any coordinate is invalid."
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
111 [array value & coordinates]
|
||||
112 [array value & coordinates]
|
||||
</span><br/>
|
||||
<span class="partial" title="6 out of 7 forms covered">
|
||||
112 (cond
|
||||
113 (cond
|
||||
</span><br/>
|
||||
<span class="covered" title="3 out of 3 forms covered">
|
||||
113 (nil? value)
|
||||
114 (nil? value)
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
114 nil
|
||||
115 nil
|
||||
</span><br/>
|
||||
<span class="covered" title="2 out of 2 forms covered">
|
||||
115 (unsafe-sparse-operations?)
|
||||
116 (unsafe-sparse-operations?)
|
||||
</span><br/>
|
||||
<span class="covered" title="5 out of 5 forms covered">
|
||||
116 (unsafe-put array value coordinates)
|
||||
117 (unsafe-put array value coordinates)
|
||||
</span><br/>
|
||||
<span class="covered" title="5 out of 5 forms covered">
|
||||
117 (not (sparse-array? array))
|
||||
118 (not (sparse-array? array))
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 7 forms covered">
|
||||
118 (throw (ex-info "Sparse array expected" {:array array}))
|
||||
119 (throw (ex-info "Sparse array expected" {:array array}))
|
||||
</span><br/>
|
||||
<span class="covered" title="7 out of 7 forms covered">
|
||||
119 (not= (:dimensions array) (count coordinates))
|
||||
120 (not= (:dimensions array) (count coordinates))
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
120 (throw
|
||||
121 (throw
|
||||
</span><br/>
|
||||
<span class="covered" title="2 out of 2 forms covered">
|
||||
121 (ex-info
|
||||
122 (ex-info
|
||||
</span><br/>
|
||||
<span class="covered" title="9 out of 9 forms covered">
|
||||
122 (str "Expected " (:dimensions array) " coordinates; found " (count coordinates))
|
||||
123 (str "Expected " (:dimensions array) " coordinates; found " (count coordinates))
|
||||
</span><br/>
|
||||
<span class="covered" title="4 out of 4 forms covered">
|
||||
123 {:array array
|
||||
124 {:array array
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
124 :coordinates coordinates}))
|
||||
125 :coordinates coordinates}))
|
||||
</span><br/>
|
||||
<span class="covered" title="2 out of 2 forms covered">
|
||||
125 (not
|
||||
126 (not
|
||||
</span><br/>
|
||||
<span class="covered" title="3 out of 3 forms covered">
|
||||
126 (every?
|
||||
127 (every?
|
||||
</span><br/>
|
||||
<span class="partial" title="13 out of 15 forms covered">
|
||||
127 #(and (integer? %) (or (zero? %) (pos? %)))
|
||||
128 #(and (integer? %) (or (zero? %) (pos? %)))
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
128 coordinates))
|
||||
129 coordinates))
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 1 forms covered">
|
||||
129 (throw
|
||||
130 (throw
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 3 forms covered">
|
||||
130 (ex-info
|
||||
131 (ex-info
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
131 "Coordinates must be zero or positive integers"
|
||||
132 "Coordinates must be zero or positive integers"
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 5 forms covered">
|
||||
132 {:array array
|
||||
133 {:array array
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 1 forms covered">
|
||||
133 :coordinates coordinates
|
||||
134 :coordinates coordinates
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 13 forms covered">
|
||||
134 :invalid (remove #(and (pos? %) (integer? %)) coordinates)}))
|
||||
135 :invalid (remove #(and (pos? %) (integer? %)) coordinates)}))
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
135 :else
|
||||
136 :else
|
||||
</span><br/>
|
||||
<span class="covered" title="5 out of 5 forms covered">
|
||||
136 (unsafe-put array value coordinates)))
|
||||
137 (unsafe-put array value coordinates)))
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
137
|
||||
138
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
138 (defn- unsafe-get
|
||||
139 (defn- unsafe-get
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
139 ;; TODO: I am CERTAIN there is a more elegant solution to this.
|
||||
140 ;; TODO: I am CERTAIN there is a more elegant solution to this.
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
140 [array coordinates]
|
||||
141 [array coordinates]
|
||||
</span><br/>
|
||||
<span class="covered" title="6 out of 6 forms covered">
|
||||
141 (let [v (array (first coordinates))]
|
||||
142 (let [v (array (first coordinates))]
|
||||
</span><br/>
|
||||
<span class="covered" title="4 out of 4 forms covered">
|
||||
142 (cond
|
||||
143 (cond
|
||||
</span><br/>
|
||||
<span class="covered" title="5 out of 5 forms covered">
|
||||
143 (= :data (:content array))
|
||||
144 (= :data (:content array))
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
144 v
|
||||
145 v
|
||||
</span><br/>
|
||||
<span class="covered" title="3 out of 3 forms covered">
|
||||
145 (nil? v)
|
||||
146 (nil? v)
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
146 nil
|
||||
147 nil
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
147 :else
|
||||
148 :else
|
||||
</span><br/>
|
||||
<span class="covered" title="9 out of 9 forms covered">
|
||||
148 (apply get (cons v (rest coordinates))))))
|
||||
149 (apply get (cons v (rest coordinates))))))
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
149
|
||||
150
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
150 (defn get
|
||||
151 (defn get
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
151 "Return the value in this sparse `array` at these `coordinates`."
|
||||
152 "Return the value in this sparse `array` at these `coordinates`."
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
152 [array & coordinates]
|
||||
153 [array & coordinates]
|
||||
</span><br/>
|
||||
<span class="covered" title="5 out of 5 forms covered">
|
||||
153 (cond
|
||||
154 (cond
|
||||
</span><br/>
|
||||
<span class="covered" title="2 out of 2 forms covered">
|
||||
154 (unsafe-sparse-operations?)
|
||||
155 (unsafe-sparse-operations?)
|
||||
</span><br/>
|
||||
<span class="covered" title="4 out of 4 forms covered">
|
||||
155 (unsafe-get array coordinates)
|
||||
156 (unsafe-get array coordinates)
|
||||
</span><br/>
|
||||
<span class="covered" title="5 out of 5 forms covered">
|
||||
156 (not (sparse-array? array))
|
||||
157 (not (sparse-array? array))
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 7 forms covered">
|
||||
157 (throw (ex-info "Sparse array expected" {:array array}))
|
||||
158 (throw (ex-info "Sparse array expected" {:array array}))
|
||||
</span><br/>
|
||||
<span class="covered" title="5 out of 5 forms covered">
|
||||
158 (not (every?
|
||||
159 (not (every?
|
||||
</span><br/>
|
||||
<span class="partial" title="13 out of 15 forms covered">
|
||||
159 #(and (integer? %) (or (zero? %) (pos? %)))
|
||||
160 #(and (integer? %) (or (zero? %) (pos? %)))
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
160 coordinates))
|
||||
161 coordinates))
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 1 forms covered">
|
||||
161 (throw
|
||||
162 (throw
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 3 forms covered">
|
||||
162 (ex-info
|
||||
163 (ex-info
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
163 "Coordinates must be zero or positive integers"
|
||||
164 "Coordinates must be zero or positive integers"
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 5 forms covered">
|
||||
164 {:array array
|
||||
165 {:array array
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 1 forms covered">
|
||||
165 :coordinates coordinates
|
||||
166 :coordinates coordinates
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 13 forms covered">
|
||||
166 :invalid (remove #(and (pos? %) (integer? %)) coordinates)}))
|
||||
167 :invalid (remove #(and (pos? %) (integer? %)) coordinates)}))
|
||||
</span><br/>
|
||||
<span class="covered" title="8 out of 8 forms covered">
|
||||
167 (not (= (:dimensions array) (count coordinates)))
|
||||
168 (not (= (:dimensions array) (count coordinates)))
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
168 (throw
|
||||
169 (throw
|
||||
</span><br/>
|
||||
<span class="covered" title="2 out of 2 forms covered">
|
||||
169 (ex-info
|
||||
170 (ex-info
|
||||
</span><br/>
|
||||
<span class="covered" title="9 out of 9 forms covered">
|
||||
170 (str "Expected " (:dimensions array) " coordinates; found " (count coordinates))
|
||||
171 (str "Expected " (:dimensions array) " coordinates; found " (count coordinates))
|
||||
</span><br/>
|
||||
<span class="covered" title="4 out of 4 forms covered">
|
||||
171 {:array array
|
||||
172 {:array array
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
172 :coordinates coordinates}))
|
||||
173 :coordinates coordinates}))
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
173 :else
|
||||
174 :else
|
||||
</span><br/>
|
||||
<span class="covered" title="4 out of 4 forms covered">
|
||||
174 (unsafe-get array coordinates)))
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
175
|
||||
175 (unsafe-get array coordinates)))
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
176
|
||||
|
|
|
@ -8,205 +8,214 @@
|
|||
001 (ns sparse-array.extract
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
002 (:require [sparse-array.core :refer :all]))
|
||||
002 "Extracting interesting data from sparse arrays."
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
003 (:require [sparse-array.core :refer [*safe-sparse-operations*
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
004 dense-array? dense-dimensions
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
005 make-sparse-array sparse-array?]]))
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
003
|
||||
006
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
004 ;;; The whole point of working with sparse arrays is to work with interesting
|
||||
007 ;;; The whole point of working with sparse arrays is to work with interesting
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
005 ;;; subsets of arrays most of which are uninteresting. To extract an
|
||||
008 ;;; subsets of arrays most of which are uninteresting. To extract an
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
006 ;;; interesting subset from an array, we're going to need an extract function.
|
||||
009 ;;; interesting subset from an array, we're going to need an extract function.
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
007
|
||||
010
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
008 (defn- extract-from-sparse
|
||||
011 (defn- extract-from-sparse
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
009 "Return a subset of this sparse `array` comprising all those cells for which
|
||||
012 "Return a subset of this sparse `array` comprising all those cells for which
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
010 this `function` returns a 'truthy' value."
|
||||
013 this `function` returns a 'truthy' value."
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
011 [array function]
|
||||
014 [array function]
|
||||
</span><br/>
|
||||
<span class="covered" title="2 out of 2 forms covered">
|
||||
012 (reduce
|
||||
015 (reduce
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
013 merge
|
||||
016 merge
|
||||
</span><br/>
|
||||
<span class="covered" title="2 out of 2 forms covered">
|
||||
014 (apply
|
||||
017 (apply
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
015 make-sparse-array
|
||||
018 make-sparse-array
|
||||
</span><br/>
|
||||
<span class="covered" title="2 out of 2 forms covered">
|
||||
016 (cons
|
||||
019 (cons
|
||||
</span><br/>
|
||||
<span class="covered" title="3 out of 3 forms covered">
|
||||
017 (:coord array)
|
||||
020 (:coord array)
|
||||
</span><br/>
|
||||
<span class="covered" title="9 out of 9 forms covered">
|
||||
018 (if (coll? (:content array)) (:content array))))
|
||||
<span class="covered" title="10 out of 10 forms covered">
|
||||
021 (when (coll? (:content array)) (:content array))))
|
||||
</span><br/>
|
||||
<span class="covered" title="3 out of 3 forms covered">
|
||||
019 (map
|
||||
022 (map
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
020 #(if
|
||||
023 #(if
|
||||
</span><br/>
|
||||
<span class="covered" title="5 out of 5 forms covered">
|
||||
021 (= :data (:content array))
|
||||
024 (= :data (:content array))
|
||||
</span><br/>
|
||||
<span class="covered" title="11 out of 11 forms covered">
|
||||
022 (if (function (array %)) {% (array %)})
|
||||
<span class="covered" title="12 out of 12 forms covered">
|
||||
025 (when (function (array %)) {% (array %)})
|
||||
</span><br/>
|
||||
<span class="covered" title="7 out of 7 forms covered">
|
||||
023 (let [v (extract-from-sparse (array %) function)]
|
||||
026 (let [v (extract-from-sparse (array %) function)]
|
||||
</span><br/>
|
||||
<span class="covered" title="2 out of 2 forms covered">
|
||||
024 (if
|
||||
027 (if
|
||||
</span><br/>
|
||||
<span class="covered" title="2 out of 2 forms covered">
|
||||
025 (empty?
|
||||
028 (empty?
|
||||
</span><br/>
|
||||
<span class="covered" title="6 out of 6 forms covered">
|
||||
026 (filter integer? (keys v)))
|
||||
029 (filter integer? (keys v)))
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
027 nil
|
||||
030 nil
|
||||
</span><br/>
|
||||
<span class="covered" title="3 out of 3 forms covered">
|
||||
028 {% v})))
|
||||
031 {% v})))
|
||||
</span><br/>
|
||||
<span class="covered" title="6 out of 6 forms covered">
|
||||
029 (filter integer? (keys array)))))
|
||||
032 (filter integer? (keys array)))))
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
030
|
||||
033
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
031 (defn extract-from-dense
|
||||
034 (defn extract-from-dense
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
032 "Return a subset of this dense `array` comprising all those cells for which
|
||||
035 "Return a subset of this dense `array` comprising all those cells for which
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
033 this `function` returns a 'truthy' value. Use these `axes` if provided."
|
||||
036 this `function` returns a 'truthy' value. Use these `axes` if provided."
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
034 ([array function]
|
||||
037 ([array function]
|
||||
</span><br/>
|
||||
<span class="covered" title="15 out of 15 forms covered">
|
||||
035 (extract-from-dense array function (map #(keyword (str "i" %)) (range))))
|
||||
038 (extract-from-dense array function (map #(keyword (str "i" %)) (range))))
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
036 ([array function axes]
|
||||
039 ([array function axes]
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
037 (let
|
||||
040 (let
|
||||
</span><br/>
|
||||
<span class="covered" title="3 out of 3 forms covered">
|
||||
038 [dimensions (dense-dimensions array)]
|
||||
041 [dimensions (dense-dimensions array)]
|
||||
</span><br/>
|
||||
<span class="covered" title="2 out of 2 forms covered">
|
||||
039 (reduce
|
||||
042 (reduce
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
040 merge
|
||||
043 merge
|
||||
</span><br/>
|
||||
<span class="covered" title="7 out of 7 forms covered">
|
||||
041 (apply make-sparse-array (take dimensions axes))
|
||||
044 (apply make-sparse-array (take dimensions axes))
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
042 (if
|
||||
045 (if
|
||||
</span><br/>
|
||||
<span class="covered" title="3 out of 3 forms covered">
|
||||
043 (= dimensions 1)
|
||||
046 (= dimensions 1)
|
||||
</span><br/>
|
||||
<span class="covered" title="2 out of 2 forms covered">
|
||||
044 (map
|
||||
047 (map
|
||||
</span><br/>
|
||||
<span class="covered" title="9 out of 9 forms covered">
|
||||
045 (fn [i v] (if (function v) (hash-map i v)))
|
||||
<span class="covered" title="10 out of 10 forms covered">
|
||||
048 (fn [i v] (when (function v) (hash-map i v)))
|
||||
</span><br/>
|
||||
<span class="covered" title="2 out of 2 forms covered">
|
||||
046 (range)
|
||||
049 (range)
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
047 array)
|
||||
050 array)
|
||||
</span><br/>
|
||||
<span class="covered" title="2 out of 2 forms covered">
|
||||
048 (map
|
||||
051 (map
|
||||
</span><br/>
|
||||
<span class="covered" title="15 out of 15 forms covered">
|
||||
049 (fn [i v] (if (empty? (filter integer? (keys v))) nil (hash-map i v)))
|
||||
052 (fn [i v] (if (empty? (filter integer? (keys v))) nil (hash-map i v)))
|
||||
</span><br/>
|
||||
<span class="covered" title="2 out of 2 forms covered">
|
||||
050 (range)
|
||||
053 (range)
|
||||
</span><br/>
|
||||
<span class="covered" title="11 out of 11 forms covered">
|
||||
051 (map #(extract-from-dense % function (rest axes)) array)))))))
|
||||
054 (map #(extract-from-dense % function (rest axes)) array)))))))
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
052
|
||||
055
|
||||
</span><br/>
|
||||
<span class="covered" title="1 out of 1 forms covered">
|
||||
053 (defn extract
|
||||
056 (defn extract
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
054 "Return a sparse subset of this `array` - which may be either sparse or
|
||||
057 "Return a sparse subset of this `array` - which may be either sparse or
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
055 dense - comprising all those cells for which this `function` returns a
|
||||
058 dense - comprising all those cells for which this `function` returns a
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
056 'truthy' value."
|
||||
059 'truthy' value."
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
057 [array function]
|
||||
060 [array function]
|
||||
</span><br/>
|
||||
<span class="partial" title="2 out of 4 forms covered">
|
||||
058 (cond
|
||||
061 (cond
|
||||
</span><br/>
|
||||
<span class="covered" title="3 out of 3 forms covered">
|
||||
059 (sparse-array? array)
|
||||
062 (sparse-array? array)
|
||||
</span><br/>
|
||||
<span class="covered" title="4 out of 4 forms covered">
|
||||
060 (extract-from-sparse array function)
|
||||
063 (extract-from-sparse array function)
|
||||
</span><br/>
|
||||
<span class="covered" title="3 out of 3 forms covered">
|
||||
061 (dense-array? array)
|
||||
064 (dense-array? array)
|
||||
</span><br/>
|
||||
<span class="covered" title="4 out of 4 forms covered">
|
||||
062 (extract-from-dense array function)
|
||||
065 (extract-from-dense array function)
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 1 forms covered">
|
||||
063 *safe-sparse-operations*
|
||||
066 *safe-sparse-operations*
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 1 forms covered">
|
||||
064 (throw
|
||||
067 (throw
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 3 forms covered">
|
||||
065 (ex-info
|
||||
068 (ex-info
|
||||
</span><br/>
|
||||
<span class="not-tracked" title="0 out of 0 forms covered">
|
||||
066 "Argument passed as `array` is neither sparse nor dense."
|
||||
069 "Argument passed as `array` is neither sparse nor dense."
|
||||
</span><br/>
|
||||
<span class="not-covered" title="0 out of 3 forms covered">
|
||||
067 {:array array}))))
|
||||
070 {:array array}))))
|
||||
</span><br/>
|
||||
<span class="blank" title="0 out of 0 forms covered">
|
||||
068
|
||||
071
|
||||
</span><br/>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
<!DOCTYPE html PUBLIC ""
|
||||
"">
|
||||
<html><head><meta charset="UTF-8" /><title>Sparse-array 0.3.0-SNAPSHOT</title><link rel="stylesheet" type="text/css" href="css/default.css" /><link rel="stylesheet" type="text/css" href="css/highlight.css" /><script type="text/javascript" src="js/highlight.min.js"></script><script type="text/javascript" src="js/jquery.min.js"></script><script type="text/javascript" src="js/page_effects.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body><div id="header"><h2>Generated by <a href="https://github.com/weavejester/codox">Codox</a></h2><h1><a href="index.html"><span class="project-title"><span class="project-name">Sparse-array</span> <span class="project-version">0.3.0-SNAPSHOT</span></span></a></h1></div><div class="sidebar primary"><h3 class="no-link"><span class="inner">Project</span></h3><ul class="index-link"><li class="depth-1 current"><a href="index.html"><div class="inner">Index</div></a></li></ul><h3 class="no-link"><span class="inner">Topics</span></h3><ul><li class="depth-1 "><a href="intro.html"><div class="inner"><span>Introduction to Sparse-array</span></div></a></li></ul><h3 class="no-link"><span class="inner">Namespaces</span></h3><ul><li class="depth-1"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>sparse-array</span></div></div></li><li class="depth-2 branch"><a href="sparse-array.core.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>core</span></div></a></li><li class="depth-2"><a href="sparse-array.extract.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>extract</span></div></a></li></ul></div><div class="namespace-index" id="content"><h1><span class="project-title"><span class="project-name">Sparse-array</span> <span class="project-version">0.3.0-SNAPSHOT</span></span></h1><h5 class="license">Released under the <a href="http://www.eclipse.org/legal/epl-v10.html">Eclipse Public License</a></h5><div class="doc"><p>A Clojure library designed to manipulate sparse *arrays* - multi-dimensional spaces accessed by indices, but containing arbitrary values rather than just numbers. For sparse spaces which contain numbers only, you're better to use a *sparse matrix* library, for example [clojure.core.matrix](https://mikera.github.io/core.matrix/).</p></div><h2>Installation</h2><p>To install, add the following dependency to your project or build file:</p><pre class="deps">[sparse-array "0.3.0-SNAPSHOT"]</pre><h2>Topics</h2><ul class="topics"><li><a href="intro.html">Introduction to Sparse-array</a></li></ul><h2>Namespaces</h2><div class="namespace"><h3><a href="sparse-array.core.html">sparse-array.core</a></h3><div class="doc"><pre class="plaintext">Operations on sparse arrays.</pre></div><div class="index"><p>Public variables and functions:</p><ul><li> <a href="sparse-array.core.html#var-*safe-sparse-operations*">*safe-sparse-operations*</a> </li><li> <a href="sparse-array.core.html#var-arity">arity</a> </li><li> <a href="sparse-array.core.html#var-child-arity">child-arity</a> </li><li> <a href="sparse-array.core.html#var-dense-array.3F">dense-array?</a> </li><li> <a href="sparse-array.core.html#var-dense-dimensions">dense-dimensions</a> </li><li> <a href="sparse-array.core.html#var-dense-to-sparse">dense-to-sparse</a> </li><li> <a href="sparse-array.core.html#var-get">get</a> </li><li> <a href="sparse-array.core.html#var-make-sparse-array">make-sparse-array</a> </li><li> <a href="sparse-array.core.html#var-merge-arrays">merge-arrays</a> </li><li> <a href="sparse-array.core.html#var-merge-dense-with-sparse">merge-dense-with-sparse</a> </li><li> <a href="sparse-array.core.html#var-merge-sparse-arrays">merge-sparse-arrays</a> </li><li> <a href="sparse-array.core.html#var-put">put</a> </li><li> <a href="sparse-array.core.html#var-sparse-array.3F">sparse-array?</a> </li><li> <a href="sparse-array.core.html#var-sparse-to-dense">sparse-to-dense</a> </li></ul></div></div><div class="namespace"><h3><a href="sparse-array.extract.html">sparse-array.extract</a></h3><div class="doc"><pre class="plaintext">Extracting interesting data from sparse arrays.</pre></div><div class="index"><p>Public variables and functions:</p><ul><li> <a href="sparse-array.extract.html#var-extract">extract</a> </li><li> <a href="sparse-array.extract.html#var-extract-from-dense">extract-from-dense</a> </li></ul></div></div></div></body></html>
|
||||
<html><head><meta charset="UTF-8" /><title>Sparse-array 0.3.0</title><link rel="stylesheet" type="text/css" href="css/default.css" /><link rel="stylesheet" type="text/css" href="css/highlight.css" /><script type="text/javascript" src="js/highlight.min.js"></script><script type="text/javascript" src="js/jquery.min.js"></script><script type="text/javascript" src="js/page_effects.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body><div id="header"><h2>Generated by <a href="https://github.com/weavejester/codox">Codox</a></h2><h1><a href="index.html"><span class="project-title"><span class="project-name">Sparse-array</span> <span class="project-version">0.3.0</span></span></a></h1></div><div class="sidebar primary"><h3 class="no-link"><span class="inner">Project</span></h3><ul class="index-link"><li class="depth-1 current"><a href="index.html"><div class="inner">Index</div></a></li></ul><h3 class="no-link"><span class="inner">Topics</span></h3><ul><li class="depth-1 "><a href="intro.html"><div class="inner"><span>Introduction to Sparse-array</span></div></a></li></ul><h3 class="no-link"><span class="inner">Namespaces</span></h3><ul><li class="depth-1"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>sparse-array</span></div></div></li><li class="depth-2 branch"><a href="sparse-array.core.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>core</span></div></a></li><li class="depth-2"><a href="sparse-array.extract.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>extract</span></div></a></li></ul></div><div class="namespace-index" id="content"><h1><span class="project-title"><span class="project-name">Sparse-array</span> <span class="project-version">0.3.0</span></span></h1><h5 class="license">Released under the <a href="http://www.eclipse.org/legal/epl-v10.html">Eclipse Public License</a></h5><div class="doc"><p>A Clojure library designed to manipulate sparse *arrays* - multi-dimensional spaces accessed by indices, but containing arbitrary values rather than just numbers. For sparse spaces which contain numbers only, you're better to use a *sparse matrix* library, for example [clojure.core.matrix](https://mikera.github.io/core.matrix/).</p></div><h2>Installation</h2><p>To install, add the following dependency to your project or build file:</p><pre class="deps">[sparse-array "0.3.0"]</pre><h2>Topics</h2><ul class="topics"><li><a href="intro.html">Introduction to Sparse-array</a></li></ul><h2>Namespaces</h2><div class="namespace"><h3><a href="sparse-array.core.html">sparse-array.core</a></h3><div class="doc"><div class="markdown"><p>Operations on sparse arrays.</p></div></div><div class="index"><p>Public variables and functions:</p><ul><li> <a href="sparse-array.core.html#var-*safe-sparse-operations*">*safe-sparse-operations*</a> </li><li> <a href="sparse-array.core.html#var-arity">arity</a> </li><li> <a href="sparse-array.core.html#var-child-arity">child-arity</a> </li><li> <a href="sparse-array.core.html#var-dense-array.3F">dense-array?</a> </li><li> <a href="sparse-array.core.html#var-dense-dimensions">dense-dimensions</a> </li><li> <a href="sparse-array.core.html#var-dense-to-sparse">dense-to-sparse</a> </li><li> <a href="sparse-array.core.html#var-get">get</a> </li><li> <a href="sparse-array.core.html#var-make-sparse-array">make-sparse-array</a> </li><li> <a href="sparse-array.core.html#var-merge-arrays">merge-arrays</a> </li><li> <a href="sparse-array.core.html#var-merge-dense-with-sparse">merge-dense-with-sparse</a> </li><li> <a href="sparse-array.core.html#var-merge-sparse-arrays">merge-sparse-arrays</a> </li><li> <a href="sparse-array.core.html#var-put">put</a> </li><li> <a href="sparse-array.core.html#var-sparse-array.3F">sparse-array?</a> </li><li> <a href="sparse-array.core.html#var-sparse-to-dense">sparse-to-dense</a> </li></ul></div></div><div class="namespace"><h3><a href="sparse-array.extract.html">sparse-array.extract</a></h3><div class="doc"><div class="markdown"><p>Extracting interesting data from sparse arrays.</p></div></div><div class="index"><p>Public variables and functions:</p><ul><li> <a href="sparse-array.extract.html#var-extract">extract</a> </li><li> <a href="sparse-array.extract.html#var-extract-from-dense">extract-from-dense</a> </li></ul></div></div></div></body></html>
|
|
@ -1,10 +1,10 @@
|
|||
<!DOCTYPE html PUBLIC ""
|
||||
"">
|
||||
<html><head><meta charset="UTF-8" /><title>Introduction to Sparse-array</title><link rel="stylesheet" type="text/css" href="css/default.css" /><link rel="stylesheet" type="text/css" href="css/highlight.css" /><script type="text/javascript" src="js/highlight.min.js"></script><script type="text/javascript" src="js/jquery.min.js"></script><script type="text/javascript" src="js/page_effects.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body><div id="header"><h2>Generated by <a href="https://github.com/weavejester/codox">Codox</a></h2><h1><a href="index.html"><span class="project-title"><span class="project-name">Sparse-array</span> <span class="project-version">0.3.0-SNAPSHOT</span></span></a></h1></div><div class="sidebar primary"><h3 class="no-link"><span class="inner">Project</span></h3><ul class="index-link"><li class="depth-1 "><a href="index.html"><div class="inner">Index</div></a></li></ul><h3 class="no-link"><span class="inner">Topics</span></h3><ul><li class="depth-1 current"><a href="intro.html"><div class="inner"><span>Introduction to Sparse-array</span></div></a></li></ul><h3 class="no-link"><span class="inner">Namespaces</span></h3><ul><li class="depth-1"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>sparse-array</span></div></div></li><li class="depth-2 branch"><a href="sparse-array.core.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>core</span></div></a></li><li class="depth-2"><a href="sparse-array.extract.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>extract</span></div></a></li></ul></div><div class="document" id="content"><div class="doc"><div class="markdown"><h1><a href="#introduction-to-sparse-array" name="introduction-to-sparse-array"></a>Introduction to Sparse-array</h1>
|
||||
<html><head><meta charset="UTF-8" /><title>Introduction to Sparse-array</title><link rel="stylesheet" type="text/css" href="css/default.css" /><link rel="stylesheet" type="text/css" href="css/highlight.css" /><script type="text/javascript" src="js/highlight.min.js"></script><script type="text/javascript" src="js/jquery.min.js"></script><script type="text/javascript" src="js/page_effects.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body><div id="header"><h2>Generated by <a href="https://github.com/weavejester/codox">Codox</a></h2><h1><a href="index.html"><span class="project-title"><span class="project-name">Sparse-array</span> <span class="project-version">0.3.0</span></span></a></h1></div><div class="sidebar primary"><h3 class="no-link"><span class="inner">Project</span></h3><ul class="index-link"><li class="depth-1 "><a href="index.html"><div class="inner">Index</div></a></li></ul><h3 class="no-link"><span class="inner">Topics</span></h3><ul><li class="depth-1 current"><a href="intro.html"><div class="inner"><span>Introduction to Sparse-array</span></div></a></li></ul><h3 class="no-link"><span class="inner">Namespaces</span></h3><ul><li class="depth-1"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>sparse-array</span></div></div></li><li class="depth-2 branch"><a href="sparse-array.core.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>core</span></div></a></li><li class="depth-2"><a href="sparse-array.extract.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>extract</span></div></a></li></ul></div><div class="document" id="content"><div class="doc"><div class="markdown"><h1><a href="#introduction-to-sparse-array" name="introduction-to-sparse-array"></a>Introduction to Sparse-array</h1>
|
||||
<p>A Clojure library designed to manipulate sparse <em>arrays</em> - multi-dimensional spaces accessed by indices, but containing arbitrary values rather than just numbers. For sparse spaces which contain numbers only, you’re better to use a <em>sparse matrix</em> library, <a href="https://mikera.github.io/core.matrix/">for example clojure.core.matrix</a>.</p>
|
||||
<p>Arbitrary numbers of dimensions are supported, up to limits imposed by the JVM stack.</p>
|
||||
<p>Available from Clojars: <a href="https://clojars.org/sparse-array"><img src="https://img.shields.io/clojars/v/sparse-array.svg" alt="Clojars Project" /></a> Tests currently <a href="https://circleci.com/gh/simon-brooke/sparse-array"><img src="https://circleci.com/gh/simon-brooke/sparse-array.svg?style=svg" alt="CircleCI" /></a></p>
|
||||
<h2><a href="#conventions-" name="conventions-"></a>Conventions:</h2>
|
||||
<h2><a href="#conventions" name="conventions"></a>Conventions</h2>
|
||||
<h3><a href="#sparse-arrays" name="sparse-arrays"></a>Sparse arrays</h3>
|
||||
<p>For the purposes of this library, a sparse array shall be implemented as a map, such that all keys are non-negative members of the set of integers, except for the following keyword keys, all of which are expected to be present:</p>
|
||||
<ol>
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,7 +1,3 @@
|
|||
<!DOCTYPE html PUBLIC ""
|
||||
"">
|
||||
<html><head><meta charset="UTF-8" /><title>sparse-array.extract documentation</title><link rel="stylesheet" type="text/css" href="css/default.css" /><link rel="stylesheet" type="text/css" href="css/highlight.css" /><script type="text/javascript" src="js/highlight.min.js"></script><script type="text/javascript" src="js/jquery.min.js"></script><script type="text/javascript" src="js/page_effects.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body><div id="header"><h2>Generated by <a href="https://github.com/weavejester/codox">Codox</a></h2><h1><a href="index.html"><span class="project-title"><span class="project-name">Sparse-array</span> <span class="project-version">0.3.0-SNAPSHOT</span></span></a></h1></div><div class="sidebar primary"><h3 class="no-link"><span class="inner">Project</span></h3><ul class="index-link"><li class="depth-1 "><a href="index.html"><div class="inner">Index</div></a></li></ul><h3 class="no-link"><span class="inner">Topics</span></h3><ul><li class="depth-1 "><a href="intro.html"><div class="inner"><span>Introduction to Sparse-array</span></div></a></li></ul><h3 class="no-link"><span class="inner">Namespaces</span></h3><ul><li class="depth-1"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>sparse-array</span></div></div></li><li class="depth-2 branch"><a href="sparse-array.core.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>core</span></div></a></li><li class="depth-2 current"><a href="sparse-array.extract.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>extract</span></div></a></li></ul></div><div class="sidebar secondary"><h3><a href="#top"><span class="inner">Public Vars</span></a></h3><ul><li class="depth-1"><a href="sparse-array.extract.html#var-extract"><div class="inner"><span>extract</span></div></a></li><li class="depth-1"><a href="sparse-array.extract.html#var-extract-from-dense"><div class="inner"><span>extract-from-dense</span></div></a></li></ul></div><div class="namespace-docs" id="content"><h1 class="anchor" id="top">sparse-array.extract</h1><div class="doc"><pre class="plaintext">Extracting interesting data from sparse arrays.
|
||||
</pre></div><div class="public anchor" id="var-extract"><h3>extract</h3><div class="usage"><code>(extract array function)</code></div><div class="doc"><pre class="plaintext">Return a sparse subset of this `array` - which may be either sparse or
|
||||
dense - comprising all those cells for which this `function` returns a
|
||||
'truthy' value.</pre></div><div class="src-link"><a href="https://github.com/simon-brooke/sparse-array/blob/master/src/sparse_array/extract.clj#L56">view source</a></div></div><div class="public anchor" id="var-extract-from-dense"><h3>extract-from-dense</h3><div class="usage"><code>(extract-from-dense array function)</code><code>(extract-from-dense array function axes)</code></div><div class="doc"><pre class="plaintext">Return a subset of this dense `array` comprising all those cells for which
|
||||
this `function` returns a 'truthy' value. Use these `axes` if provided.</pre></div><div class="src-link"><a href="https://github.com/simon-brooke/sparse-array/blob/master/src/sparse_array/extract.clj#L34">view source</a></div></div></div></body></html>
|
||||
<html><head><meta charset="UTF-8" /><title>sparse-array.extract documentation</title><link rel="stylesheet" type="text/css" href="css/default.css" /><link rel="stylesheet" type="text/css" href="css/highlight.css" /><script type="text/javascript" src="js/highlight.min.js"></script><script type="text/javascript" src="js/jquery.min.js"></script><script type="text/javascript" src="js/page_effects.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body><div id="header"><h2>Generated by <a href="https://github.com/weavejester/codox">Codox</a></h2><h1><a href="index.html"><span class="project-title"><span class="project-name">Sparse-array</span> <span class="project-version">0.3.0</span></span></a></h1></div><div class="sidebar primary"><h3 class="no-link"><span class="inner">Project</span></h3><ul class="index-link"><li class="depth-1 "><a href="index.html"><div class="inner">Index</div></a></li></ul><h3 class="no-link"><span class="inner">Topics</span></h3><ul><li class="depth-1 "><a href="intro.html"><div class="inner"><span>Introduction to Sparse-array</span></div></a></li></ul><h3 class="no-link"><span class="inner">Namespaces</span></h3><ul><li class="depth-1"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>sparse-array</span></div></div></li><li class="depth-2 branch"><a href="sparse-array.core.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>core</span></div></a></li><li class="depth-2 current"><a href="sparse-array.extract.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>extract</span></div></a></li></ul></div><div class="sidebar secondary"><h3><a href="#top"><span class="inner">Public Vars</span></a></h3><ul><li class="depth-1"><a href="sparse-array.extract.html#var-extract"><div class="inner"><span>extract</span></div></a></li><li class="depth-1"><a href="sparse-array.extract.html#var-extract-from-dense"><div class="inner"><span>extract-from-dense</span></div></a></li></ul></div><div class="namespace-docs" id="content"><h1 class="anchor" id="top">sparse-array.extract</h1><div class="doc"><div class="markdown"><p>Extracting interesting data from sparse arrays.</p></div></div><div class="public anchor" id="var-extract"><h3>extract</h3><div class="usage"><code>(extract array function)</code></div><div class="doc"><div class="markdown"><p>Return a sparse subset of this <code>array</code> - which may be either sparse or dense - comprising all those cells for which this <code>function</code> returns a ‘truthy’ value.</p></div></div><div class="src-link"><a href="https://github.com/simon-brooke/sparse-array/blob/master/src/sparse_array/extract.clj#L56">view source</a></div></div><div class="public anchor" id="var-extract-from-dense"><h3>extract-from-dense</h3><div class="usage"><code>(extract-from-dense array function)</code><code>(extract-from-dense array function axes)</code></div><div class="doc"><div class="markdown"><p>Return a subset of this dense <code>array</code> comprising all those cells for which this <code>function</code> returns a ‘truthy’ value. Use these <code>axes</code> if provided.</p></div></div><div class="src-link"><a href="https://github.com/simon-brooke/sparse-array/blob/master/src/sparse_array/extract.clj#L34">view source</a></div></div></div></body></html>
|
|
@ -1,4 +1,4 @@
|
|||
(defproject sparse-array "0.3.0"
|
||||
(defproject sparse-array "0.3.0-SNAPSHOT"
|
||||
:aot :all
|
||||
:cloverage {:output "docs/cloverage"}
|
||||
:codox {:metadata {:doc "**TODO**: write docs"
|
||||
|
|
Loading…
Reference in a new issue