Hi, I have been having issues with polymorphic functions when using partial
. I finally got it to pass but I don’t know what 3rd, 4th and 5th parameters are for.
(t/ann zipmap-test [(t/Vec t/Kw) -> (t/Map t/Kw t/Str)])
(defn zipmap-test [column-names]
(let [partialt (t/inst partial (t/Map t/Kw t/Str) (t/Vec t/Kw) t/Any t/Any
t/Any (t/Vec t/Str))]
((partialt zipmap column-names) ["a" "b" "c" "d"])))
Apart from that, is there a better way to describe the types in this case?ppold: it might be easier to use ann-form to give partialt a more specific type
ie (ann-form partial [[ -> ...] ....-> ....])
that should also work
the other problem is that zipmap is polymorphic too
so you can do the same to zipmap, use ann-form or inst
(partial (inst zipmap Kw Str) column-names) might work
@ambrosebs using inst in zipmap actually worked! I tried that first but I actually sent (t/Vec t/Kw) (t/Vec (t/Str) as arguments, and though that the problem must be in partial.
I still have issues understanding the error messages but I am still liking core.typed a lot!