Skip to content

Instantly share code, notes, and snippets.

@sherbondy
Last active December 22, 2015 05:49
Show Gist options
  • Save sherbondy/6426552 to your computer and use it in GitHub Desktop.
Save sherbondy/6426552 to your computer and use it in GitHub Desktop.
definition missing complaint
ns rt.core
(:refer-clojure :exclude [+ - * /])
(:require [clojure.core.typed :as typed
:refer [ann ann-datatype ann-form ann-record check-ns tc-ignore]])
(:require [clojure.algo.generic.arithmetic :as arith :refer [+ - * /]]))
(ann-record Vec3 [x :- Number y :- Number z :- Number])
(defrecord Vec3 [x y z])
(ann ^:no-check clojure.algo.generic.arithmetic/+ [Vec3 Vec3 -> Vec3])
(defmethod + [Vec3 Vec3]
[{x :x y :y z :z} {a :x b :y c :z}]
(Vec3. (+ x a) (+ y b) (+ z c)))
(+ (Vec3. 1 2 3) (Vec3. 3 4 5))
;; (check-ns) :ok
~
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment