For greater clarity, I've cleaned up the code and broken it into 2 files,
record-play0 and record-play:
(ns aatree.record-play0)
(set! *warn-on-reflection* true)
(defrecord base [])
(defn new-base [opts]
(-> (->base)
(into opts)
(assoc :blap (fn [this] 42))))
(defrecord wackel [])
(defn new-wackel [opts]
(-> (->wackel)
(into opts)
(assoc :blip (fn [this x y z] (+ x y z)))))
---
(ns aatree.record-play
(:require [aatree.record-play0 :refer :all]))
(set! *warn-on-reflection* true)
(defprotocol gran
(blip [this x y z])
(blap [this]))
(def w (-> {} new-base new-wackel))
(extend-type aatree.record_play0.wackel
gran
(blip [this x y z]
((:blip this) this x y z))
(blap [this]
((:blap this) this)))
(def w (-> {} new-base new-wackel))
(println (blip w 1 2 3)) ; -> 6
(println (blap w)) ; -> 42
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.