Re: CLJOS -> Spinoza, 3X faster than struct-map ;)

2009-02-07 Thread mikel
On Feb 7, 12:32 pm, David Nolen wrote: > > On the issue list there is a patch for per-defmulti hierarchies, > > waiting for Rich's approval. Although it's not predicate dispatch > > it might help to bridge the time until the SoC project gives us > > predicate dispatch. > > > Sincerely > > Meike

Re: CLJOS -> Spinoza, 3X faster than struct-map ;)

2009-02-07 Thread mikel
On Feb 6, 5:18 pm, David Nolen wrote: > > I built 4 iterations of a model/protocol/thing system, accumulating > > more requirements for it with each iteration. This discussion has had > > the nice side-effect of grooming my requirements into a tidy state > > that I can use for reference. What I

Re: CLJOS -> Spinoza, 3X faster than struct-map ;)

2009-02-07 Thread David Nolen
> > On the issue list there is a patch for per-defmulti hierarchies, > waiting for Rich's approval. Although it's not predicate dispatch > it might help to bridge the time until the SoC project gives us > predicate dispatch. > > Sincerely > Meikel > > +1 for this, without this the usefulness of mak

Re: CLJOS -> Spinoza, 3X faster than struct-map ;)

2009-02-07 Thread Meikel Brandmeyer
Hello, Am 06.02.2009 um 09:34 schrieb mikel: (prefer-method frob ::idea ::thing) (prefer-method [::runtime-tag1 ::idea] [::runtime-tag1 ::thing]) (prefer-method [::runtime-tag2 ::thing] [::runtime-tag2 ::idea]) Provide a dispatch fn that extracts the runtime tag. Yuck. Instead of definin

Re: CLJOS -> Spinoza, 3X faster than struct-map ;)

2009-02-06 Thread David Nolen
> > I built 4 iterations of a model/protocol/thing system, accumulating > more requirements for it with each iteration. This discussion has had > the nice side-effect of grooming my requirements into a tidy state > that I can use for reference. What I'm doing next is stripping out all > of the m/p/

Re: CLJOS -> Spinoza, 3X faster than struct-map ;)

2009-02-06 Thread mikel
On Feb 6, 7:27 am, David Nolen wrote: > > Yuck. Instead of defining a method on ::idea, you now must define a > > method on [something-that-has-no-meaning-in-context  ::idea] (because > > the dispatch function must now return a vector, which means the > > defmethods must now be called on vector

Re: CLJOS -> Spinoza, 3X faster than struct-map ;)

2009-02-06 Thread David Nolen
> > Yuck. Instead of defining a method on ::idea, you now must define a > method on [something-that-has-no-meaning-in-context ::idea] (because > the dispatch function must now return a vector, which means the > defmethods must now be called on vector dispatch values...). Sure but as you mention

Re: CLJOS -> Spinoza, 3X faster than struct-map ;)

2009-02-06 Thread mikel
On Feb 6, 12:18 am, David Nolen wrote: > >   (prefer-method frob ::idea ::thing) > > (prefer-method [::runtime-tag1 ::idea] [::runtime-tag1 ::thing]) > (prefer-method [::runtime-tag2 ::thing] [::runtime-tag2 ::idea]) > > Provide a dispatch fn that extracts the runtime tag. Yuck. Instead of def

Re: CLJOS -> Spinoza, 3X faster than struct-map ;)

2009-02-05 Thread David Nolen
Have thoughts about this, will have to collect them, will reply soon. On Thu, Feb 5, 2009 at 9:06 PM, mikel wrote: > > > > On Feb 5, 7:12 pm, David Nolen wrote: > > > I'm not looking for a way to statically define protocols in which > > > classes participate. Consider an example similar to the

Re: CLJOS -> Spinoza, 3X faster than struct-map ;)

2009-02-05 Thread David Nolen
> > (prefer-method frob ::idea ::thing) > (prefer-method [::runtime-tag1 ::idea] [::runtime-tag1 ::thing]) (prefer-method [::runtime-tag2 ::thing] [::runtime-tag2 ::idea]) Provide a dispatch fn that extracts the runtime tag. --~--~-~--~~~---~--~~ You received th

Re: CLJOS -> Spinoza, 3X faster than struct-map ;)

2009-02-05 Thread mikel
On Feb 5, 7:44 pm, David Nolen wrote: > >  The fly in the ointment is: what happens if both > > protocols specialize frob? Then Clojure will complain that it can't > > tell which method to call. In order to resolve that problem, we must > > use prefer-method to declare that one protocol or the

Re: CLJOS -> Spinoza, 3X faster than struct-map ;)

2009-02-05 Thread mikel
On Feb 5, 7:12 pm, David Nolen wrote: > > I'm not looking for a way to statically define protocols in which > > classes participate. Consider an example similar to the one I gave in > > my reply to Laurent: > > Static defining of anything is just a matter of chose, especially in > Clojure.  For

Re: CLJOS -> Spinoza, 3X faster than struct-map ;)

2009-02-05 Thread David Nolen
> > The fly in the ointment is: what happens if both > protocols specialize frob? Then Clojure will complain that it can't > tell which method to call. In order to resolve that problem, we must > use prefer-method to declare that one protocol or the other is > preferred. > > But what if I want to

Re: CLJOS -> Spinoza, 3X faster than struct-map ;)

2009-02-05 Thread David Nolen
> > I'm not looking for a way to statically define protocols in which > classes participate. Consider an example similar to the one I gave in > my reply to Laurent: Static defining of anything is just a matter of chose, especially in Clojure. For example in Spinoza you have pose-as which changes

Re: CLJOS -> Spinoza, 3X faster than struct-map ;)

2009-02-05 Thread mikel
On Feb 5, 3:01 pm, David Nolen wrote: > > I don't argue that this model is better than what you're doing with > > Spinoza, but for years (see > >http://www.mactech.com/articles/frameworks/8_2/Protocol_Evins.html > > from 1994) I've wanted an object model that explicitly separates > > structure

Re: CLJOS -> Spinoza, 3X faster than struct-map ;)

2009-02-05 Thread mikel
On Feb 5, 6:36 am, Laurent PETIT wrote: > Doesn't that sound  like multifunctions whose dispatching is tied to the > type ('model') of a 'thing' ? Yes, but see below. > Once again, does'nt this correspond to the introduction of the interface > concept in java ? No. I think the article I li

Re: CLJOS -> Spinoza, 3X faster than struct-map ;)

2009-02-05 Thread David Nolen
(isa? [:spinoza-example-one/circle] [:spinoza/object]) ;; true Just to note, the above shows that protocols could have their own inheritance chain. This is insanely powerful and could be implemented very quickly. --~--~-~--~~~---~--~~ You received this message bec

Re: CLJOS -> Spinoza, 3X faster than struct-map ;)

2009-02-05 Thread David Nolen
> > I don't argue that this model is better than what you're doing with > Spinoza, but for years (see > http://www.mactech.com/articles/frameworks/8_2/Protocol_Evins.html > from 1994) I've wanted an object model that explicitly separates > structure from protocol, and since I partially built one in

Re: CLJOS -> Spinoza, 3X faster than struct-map ;)

2009-02-05 Thread chris
A protocol is a level of abstraction above an interface. Java (and c++) virtual dispatch is one implementation of a meta-object protocol, where dispatch is dynamic upon the first argument to the function and object derivation means a certain order of function overriding, etc. Most likely mikel i

Re: CLJOS -> Spinoza, 3X faster than struct-map ;)

2009-02-05 Thread Laurent PETIT
Hello, Please accept my apologizes if the following remarks/questions sound stupid or silly to you, but I can't resist ask/remark in order to gain a better understanding of what you meant when writing the following : 2009/2/5 mikel > On Feb 1, 7:22 pm, David Nolen wrote: > > > > (time (dotime

Re: CLJOS -> Spinoza, 3X faster than struct-map ;)

2009-02-05 Thread mikel
On Feb 1, 7:22 pm, David Nolen wrote: > I've changed the name of my project since that was a joke > anyway.http://github.com/swannodette/spinoza/tree/master > > Spinoza isn't just for people who want object oriented behaviors.  It's also > for anyone who plans on instantiating many structs.  S

Re: CLJOS -> Spinoza, 3X faster than struct-map ;)

2009-02-03 Thread David Nolen
Haha, nope that's probably beyond the scope of what I'm trying to achieve. Spinoza just adds some object orientedness to struct-maps that's all. As far as I can tell there not much explicit control over memory consumption in Clojure. On Tue, Feb 3, 2009 at 2:56 PM, Bradbev wrote: > > On Feb 1,

Re: CLJOS -> Spinoza, 3X faster than struct-map ;)

2009-02-03 Thread Bradbev
On Feb 1, 5:22 pm, David Nolen wrote: > I've changed the name of my project since that was a joke > anyway.http://github.com/swannodette/spinoza/tree/master > > Spinoza isn't just for people who want object oriented behaviors.  It's also > for anyone who plans on instantiating many structs.  Spi

Re: CLJOS -> Spinoza, 3X faster than struct-map ;)

2009-02-02 Thread Mark Volkmann
On Mon, Feb 2, 2009 at 11:10 AM, David Nolen wrote: > Just to be clear make-instance is a macro on struct: Ah! That wasn't clear to be before. I thought you were making a case for plain maps being more efficient than struct-maps. -- R. Mark Volkmann Object Computing, Inc. --~--~-~--~-

Re: CLJOS -> Spinoza, 3X faster than struct-map ;)

2009-02-02 Thread David Nolen
Just to be clear make-instance is a macro on struct: (defmacro make-instance "Takes a defclassed struct-basis and creates a struct. Initializes properties to default values." [aclass & initializers] (let [class-key (eval (make-pair aclass)) class-sym (symbol (name aclass))

Re: CLJOS -> Spinoza, 3X faster than struct-map ;)

2009-02-02 Thread David Nolen
Hey, it is an extremely simplified example ;) Which is more readable in the long run? (struct sprite ::foobar 98 ::hunta ::laser [5.5 3.3] 4.01 78) or (make-instance foobar :id 98 :mode ::hunta :weapon ::laser

Re: CLJOS -> Spinoza, 3X faster than struct-map ;)

2009-02-02 Thread Mark Volkmann
On Sun, Feb 1, 2009 at 7:22 PM, David Nolen wrote: > I've changed the name of my project since that was a joke anyway. > http://github.com/swannodette/spinoza/tree/master > > Spinoza isn't just for people who want object oriented behaviors. It's also > for anyone who plans on instantiating many

Re: CLJOS -> Spinoza, 3X faster than struct-map ;)

2009-02-02 Thread Zak Wilson
In your example, why are you using struct-map to create your structs instead of just using struct? (struct rect-struct ::rect [50 50] 100 190) produces the same struct, but is about three times faster than using struct-map. (time (dotimes [x 100] (struct-map rect-struct :tag ::rect

CLJOS -> Spinoza, 3X faster than struct-map ;)

2009-02-01 Thread David Nolen
I've changed the name of my project since that was a joke anyway. http://github.com/swannodette/spinoza/tree/master Spinoza isn't just for people who want object oriented behaviors. It's also for anyone who plans on instantiating many structs. Spinoza's make-instance macro automatically orders y