Reputation: 1389
I am trying to define a type definition for this datastructure:
[[:id :int :null false :pk true :autoinc true]
[:fooname [:varchar 40] :null false]
[:age :int :null false]]
And then I have a filter function which removes every vector containing :id
as the first element like this:
(defn filter-id-columns [l]
(remove #(= :id (first %)) l))
But, no matter what I try I always get a type error like this:
Type Error (leiningen/code_generator.clj:23:19) Polymorphic function first could not be applied to arguments:
Polymorphic Variables:
x
Domains:
(t/HSequential [x t/Any *])
(t/Option (t/EmptySeqable x))
(t/NonEmptySeqable x)
(t/Option (clojure.lang.Seqable x))
Arguments:
t/Any
Ranges:
x :object {:path [(Nth 0)], :id 0}
nil
x
(t/Option x)
in: (first p1__27917#)
in: (first p1__27917#)
I understand that I am providing the wrong type for the input argument, however, I fail to find the right thing.
Any ideas on how to fix this?
Upvotes: 1
Views: 64
Reputation: 1220
Function parameters default to Any
. You must expand your local function definition like this: (t/fn [x :- (U nil (Seqable Any))] ...)
.
Upvotes: 1