Re: Generic functions again

2009-03-25 Thread Laurent PETIT
Could possibly clojure multimethods be enhanced to support more general use cases (enabling to e.g. define generic functions on top of it), while still be fast for the current behavior ? It seems to me that being able to redefine the function that matches the computed dispatch-value of the call to

Re: Generic functions again

2009-03-25 Thread mikel
On Mar 24, 10:51 pm, mikel wrote: > On Mar 24, 5:37 pm, Meikel Brandmeyer wrote: [...snip...] I wanted to call out a point that I made before, but that is maybe buried in a little too much verbiage. The point is that there is maybe a way for me to implement an automated and predictable answe

Re: Generic functions again

2009-03-24 Thread Cosmin Stejerean
On Tue, Mar 24, 2009 at 5:37 PM, Meikel Brandmeyer wrote: > Hi, > > Am 24.03.2009 um 22:36 schrieb mikel: > > CLOS says that if two matches are otherwise equally specific, the one >> on the left wins. Similarly, it says that if two classes define slots >> with the same name, the one farthest fro

Re: Generic functions again

2009-03-24 Thread mikel
On Mar 24, 5:37 pm, Meikel Brandmeyer wrote: > Hi, > > Am 24.03.2009 um 22:36 schrieb mikel: > > > CLOS says that if two matches are otherwise equally specific, the one > > on the left wins. Similarly, it says that if two classes define slots > > with the same name, the one farthest from the ro

Re: Generic functions again

2009-03-24 Thread Meikel Brandmeyer
Hi, Am 24.03.2009 um 22:36 schrieb mikel: CLOS says that if two matches are otherwise equally specific, the one on the left wins. Similarly, it says that if two classes define slots with the same name, the one farthest from the root of the class heterarchy (as defined by a standard traversal al

Re: Generic functions again

2009-03-24 Thread mikel
On Mar 24, 3:39 pm, Meikel Brandmeyer wrote: > Hi, > > Am 24.03.2009 um 18:51 schrieb mikel: > > >>>        (define-method add [x y] ...) > >>>        (define-method add [[x java.lang.Integer] y] ...) > >>>        (define-method add [x [y java.lang.Integer]] ...) > > >>> and call (add 3 3). Whi

Re: Generic functions again

2009-03-24 Thread Meikel Brandmeyer
Hi, Am 24.03.2009 um 18:51 schrieb mikel: (define-method add [x y] ...) (define-method add [[x java.lang.Integer] y] ...) (define-method add [x [y java.lang.Integer]] ...) and call (add 3 3). Which of the methods is chosen? Isn't it the second, which is the most specific

Re: Generic functions again

2009-03-24 Thread mikel
On Mar 24, 7:59 am, Laurent PETIT wrote: > 2009/3/24 Konrad Hinsen > > > > > > > > > On Mar 24, 2009, at 11:19, mikel wrote: > > > > Dispatch is wholly deterministic; you never need prefer-method. There > > > Then what is the rule for choosing one method when there are several > > that match t

Re: Generic functions again

2009-03-24 Thread Laurent PETIT
2009/3/24 Konrad Hinsen > > On Mar 24, 2009, at 11:19, mikel wrote: > > > Dispatch is wholly deterministic; you never need prefer-method. There > > Then what is the rule for choosing one method when there are several > that match the arguments? > > > In the scope in which a generic function is ap

Re: Generic functions again

2009-03-24 Thread Konrad Hinsen
On Mar 24, 2009, at 11:19, mikel wrote: > Dispatch is wholly deterministic; you never need prefer-method. There Then what is the rule for choosing one method when there are several that match the arguments? > In the scope in which a generic function is applied, next-method is > always bound t