Robert Klemme <bob.news / gmx.net> wrote:
> I know that, sorry if I wasn't clear enough. What bugs me is the fact that
> the block with a single argument has negative arity, indicating that there
> can be more arguments. Why then doesn't the block with two arguments have
> arity -2, too?  Or otherwise, why doesn't the block with |a| have arity 1?

Tangentially, is the following code safe:

 def initialize(*factors)
   @factors = factors
   @filters = []
   @factors.select {|i| i.is_a?(Proc)}.each {|fn|
     (@filters[(fn.arity.abs) -1] ||= []) << fn
     # ( a kludge to get around the fact that {|x|}.arity = -1 )
   } 
   @factors.reject!{|i| i.is_a?(Proc)}
   @dim = @factors.length
 end

assuming the blocks in @factors are guaranteed not to have *d arguments?
Or is there some insidious corner case I'm missing?

martin