Firstly, you should not provide your own type for apply
; it's implemented as a special case in the type checker.
In this case, core.typed needs a bit of convincing that max
will never be called with zero arguments.
Here's one approach:
(ann euler3 [Int -> Number])
(defn euler3
[n]
(let [[f & r] (map num (filter prime? (factors n)))]
(if f
(apply max f r)
(throw (Exception. "No prime factors")))))