robertluo/fun-map

defrecord+

robertluo opened this issue · 1 comments

fun-map can become an implementation of defrecord+, provide accessor pattern to it.

(defrecord+ FooType [a b]
   (accessors
      :foo/sum [a b] (+ a b))
      :foo/average [:foo/sum] (/ sum 2))
   
   ProtocolA
   (foo [{:keys [:foo/sum]} other]
      (+ sum b other)))

need more thought.