Re: Fun with decorators and unification dispatch

2005-09-11 Thread Talin
Well, the Matrix matching function now works as described above: @Arity( MatchMatrix( MatchInteger.n, MatchInteger.n ).x ) Now I am trying to see if I can write the rules for Derviative()... -- http://mail.python.org/mailman/listinfo/python-list

Re: Fun with decorators and unification dispatch

2005-09-10 Thread talin at acm dot org
Yes, it was a typo. Even thought the function has not yet been bound to the name "Factorial" when it calls the decorator, the function's __name__ attribute is set to it, so I use that to look up the name of the generic. Here''s the source for Arity: def Arity( *pattern ): """A function decor

Re: Fun with decorators and unification dispatch

2005-09-10 Thread Paul Rubin
"talin at acm dot org" <[EMAIL PROTECTED]> writes: > # Declare that "Factor" is a generic function > Factorial = Function() Was the comment a typo for Factorial? > # Define Factorial( 0 ) > @Arity( 0 ) > def Factorial(): > return 1 Overriding old definition of Factorial > # Define Factorial

Fun with decorators and unification dispatch

2005-09-10 Thread talin at acm dot org
Been playing around a bit more with developing my python inference engine, and I thought it might be of general interest (plus, I am finding the criticism useful). My original goal was to brush up on my math skills. Now, I've long felt that the best way to learn a language *thoroughly* is to write