Re: Extending a data model

2014-04-15 Thread Colin Yates
Multimethods are fantastic and do indeed work across namespaces if by "across namespaces" you mean you can defmethod in ns2 a defmulti in ns1. On Tuesday, April 15, 2014 2:56:30 AM UTC+1, Andrew Chambers wrote: > > An update, I read about protocols and multimethods. I think multimethods > are a

Re: Extending a data model

2014-04-14 Thread Andrew Chambers
An update, I read about protocols and multimethods. I think multimethods are a decent way to go (cant use protocols without a defrecord) provided they work across namespaces. On Tuesday, April 15, 2014 11:52:36 AM UTC+12, Andrew Chambers wrote: > > Hi everyone, > > I'm new to clojure and in or

Re: Extending a data model

2014-04-14 Thread Andrew Chambers
Thanks for the tip, I think multimethods may be what i need in this case (perhaps which checks the current architecture in the dispatch function so i can disable some). I want to avoid having to pass an object around and extract methods (simply because it clutters my code). Dynamically binding

Re: Extending a data model

2014-04-14 Thread Reid McKenzie
Hey Andrew, I actually built something very much along these lines a few months ago if you care to cheat off of it: http://github.com/arrdem/toothpick is an assembler generator system that works more or less along these lines. Label support is still a problem I haven't completely solved and I n

Extending a data model

2014-04-14 Thread Andrew Chambers
Hi everyone, I'm new to clojure and in order to learn I'm working on making some compiler tools which converts a lightweight IR code into assembly. My data model for an IR function is along the lines of (def code { :entry [[:loadaddr :x "global_label"] [:loadconst 1 :y]