From: "David A. Black" Date: 2004-11-08T22:31:48+09:00 Subject: Re: Succ distance between two strings Hi -- On Mon, 8 Nov 2004, Brian [ISO-8859-15] Schr�der wrote: > On Sat, 6 Nov 2004 23:07:59 +0900 > "David A. Black" wrote: > > > Hi -- > > > > On Sat, 6 Nov 2004, trans. (T. Onoma) wrote: > > > > > > > > Is there an efficient way to calculate the "succ distance" between two strings > > > (without iterating over each succession)? Examples: > > > > > > 'a'..'a' 0 > > > 'a'..'b' 1 > > > 'a'..'z' 25 > > > 'a'..'aa' 26 > > > > 'a'...'aa'.to_a.size # would be one way > > > That does not work, as the ... have a very low binding. It seems a common error I made often. > > bschroed@black:~ $ irb > irb(main):001:0> 'a'...'aa'.to_a.size > => "a"...1 > irb(main):002:0> ('a'...'aa').to_a.size > => 26 Whoops -- I did actually do it correctly in irb, to make sure, and then wrote it out wrongly instead of pasting it. It's like putting (i.e., putt-ing, in golf) -- you can never take it for granted :-) David -- David A. Black dblack@wobblini.net