3 ms·
Protocols and records exist purely for polymorphism. If you want type safety, then perhaps try core.typed: (defalias Point (HMap :mandatory {:x Num,
by weavejester 12y ago
Protocols and records exist purely for polymorphism. If you want type safety, then perhaps try core.typed:
(defalias Point
(HMap :mandatory {:x Num, :y Num}
:complete? true))
(ann add-vectors [Point Point -> Point])
(defn add-vectors [a b]
{:x (+ (:x a) (:x b))
:y (+ (:y a) (:y b))})