huri icon indicating copy to clipboard operation
huri copied to clipboard

‘rollup-transpose’ always fails in args spec

Open glts opened this issue 7 years ago • 0 comments

huri.core/rollup-transpose cannot be used because its arguments spec is impossible to satisfy.

In rollup-transpose, the argument f has the spec (s/and ::summary-fn map?). However, here ::summary-fn never conforms to a map and so the predicate is impossible to satisfy. Because rollup-transpose is instrumented, it cannot be used without explicit unstrumenting beforehand.

(->> [{:x 1, :y 5} {:x 2, :y 4} {:x 1, :y 3}]
     (rollup-transpose :x {:y-sum [sum :y]}))
; => ExceptionInfo Call to #'huri.core/rollup-transpose did not conform to spec ...

(stest/unstrument 'huri.core/rollup-transpose)
(->> [{:x 1, :y 5} {:x 2, :y 4} {:x 1, :y 3}]
     (rollup-transpose :x {:y-sum [sum :y]}))
; => {:y-sum {1 8, 2 4}}

This is with Clojure 1.9.

glts avatar Apr 25 '18 09:04 glts