File tree Expand file tree Collapse file tree 3 files changed +19
-7
lines changed
src/clj/cascalog/in_memory Expand file tree Collapse file tree 3 files changed +19
-7
lines changed Original file line number Diff line number Diff line change 204204
205205(defmethod op-clojure ::d/map
206206 [coll op input output]
207- (map
208- (fn [tuple]
209- (let [v (s/collectify (apply op (t/select-values input tuple)))
210- new-tuple (t/to-tuple output v)]
211- (merge tuple new-tuple)))
212- coll))
207+ (->> coll
208+ (map
209+ (fn [tuple]
210+ (let [v (s/collectify (or (apply op (t/select-values input tuple)) [nil ]))
211+ new-tuple (t/to-tuple output v)]
212+ (merge tuple new-tuple))))
213+ (filter #(not-any? (fn [[name v]] (and (.startsWith name " ?" ) (nil? v))) %))))
213214
214215(defmethod op-clojure ::d/mapcat
215216 [coll op input output]
Original file line number Diff line number Diff line change 1111 [names v]
1212 (if (= (count names) (count v))
1313 (zipmap names v)
14- (u/throw-illegal " Output variables arity and function output arity do not match" )))
14+ (u/throw-illegal ( str " Output variables arity and function output arity do not match: " names " -> " v) )))
1515
1616(defn to-tuples
1717 " turns [\" n\" ] and [[1] [2]] into [{\" n\" 1} {\" n\" 2}]"
Original file line number Diff line number Diff line change 2626 (is (= [{" ?n" 1 } {" ?n" 2 } {" ?n" 3 }]
2727 @results)))))
2828
29+ (deftest test-nil-collect
30+ (is (= [[nil ]]
31+ (??<- [!nilval]
32+ ([1 ] :> ?val)
33+ (identity nil :> !nilval)))))
34+
35+ (deftest test-nil-collect-to-not-nil-var
36+ (is (= []
37+ (??<- [?nilval]
38+ ([1 ] :> ?val)
39+ (identity nil :> ?nilval)))))
You can’t perform that action at this time.
0 commit comments