A big part of inheritance can be done by using defrecord, keywords and
functions instead of method, and getting read of the abstract class.
(defrecord Orange [:mass :energy :juice])
(defrecord Apple [:mass :energy :juice : family])
(defn get-juice [fruit] (:juice fruit))
--
You received this
On Wed, Aug 18, 2010 at 5:20 PM, Patrick Moriarty
wrote:
> You should look at Clojure 1.2 protocols and records which provides an easy
> way to do polymorphism on types.
> See http://clojure.org/protocols.
Protocols don't offer inheritance. The original poster specifically
mentioned porting code
You should look at Clojure 1.2 protocols and records which provides an easy
way to do polymorphism on types.
See http://clojure.org/protocols.
On 18 August 2010 08:25, Mark Engelberg wrote:
> I think the easiest way to port OO code would be to use Clojure's
> multimethods, dispatching on the ty
I think the easiest way to port OO code would be to use Clojure's
multimethods, dispatching on the type of the first argument.
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that post