dblack / candle.superlink.net wrote in message news:<Pine.LNX.4.44.0210142141510.7458-100000 / candle.superlink.net>... > Well, for what it's worth, here's my 1.7-only version (it uses > #inject). I can't help feeling there's a way to do some kind of > double inject, and avoid using the 't' accumulator... but anyway, here > is its current incarnation: > > t = 0 > ISBN_RE.match(self) && > numbers.inject(0) {|x,y| t += x+y; x+y } && > (t % 11) .zero? > end ISBN_RE.match(self) && ( (numbers.inject([0]){|x,y| x << (x[-1]+y)}.inject(0){|x,y| x+y}) % 11).zero? martin