DJ Jazzy Linefeed | 16 May 03:53
Picon

Differing output for function moved from ruby 1.8 to 1.9

Sup, fools?

This is the Levenshtein function I'm gankin' for my file comparison
project (see "40 million comparison..." thread):

# Levenshtein calculator
# Author: Paul Battley (pbattley <at> gmail.com)
# Modified slightly by John Perkins:
# -- removed $KCODE call

def distance(str1, str2)

  unpack_rule = 'C*'
  s = str1.unpack(unpack_rule)
  t = str2.unpack(unpack_rule)
  n = s.length
  m = t.length

  return m if (0 == n) # stop the madness if either string is empty
  return n if (0 == m)

  d = (0..m).to_a
  x = nil

  (0...n).each do |i|
    e = i + 1
    (0...m).each do |j|
      cost = (s[i] == t[j]) ? 0 : 1
      x = [
        d[j + 1] + 1,   # insertion
(Continue reading)

DJ Jazzy Linefeed | 16 May 05:00
Picon

Re: Differing output for function moved from ruby 1.8 to 1.9

Here's an idea: a migration script that detects when and where a
script will break after the big 1.9/2 move.

I'm not that good of a rubyist, but I know there's about a dozen
people reading these that could have it done by Friday night (I'm
looking at YOU, _why).

Phillip Gawlowski | 16 May 05:26

Re: Differing output for function moved from ruby 1.8 to 1.9


DJ Jazzy Linefeed wrote:
| Here's an idea: a migration script that detects when and where a
| script will break after the big 1.9/2 move.
|
| I'm not that good of a rubyist, but I know there's about a dozen
| people reading these that could have it done by Friday night (I'm
| looking at YOU, _why).

Maybe *the* chance to get your 15 minutes of fame, and deepen your
understanding of Ruby at the same time.

--
Phillip Gawlowski
Twitter: twitter.com/cynicalryan
Blog: http://justarubyist.blogspot.com

Use recursive procedures for recursively-defined data structures.
~            - The Elements of Programming Style (Kernighan & Plaugher)
DJ Jazzy Linefeed | 16 May 06:05
Picon

Re: Differing output for function moved from ruby 1.8 to 1.9

I think a no-brainer prerequisite to this script would be 2.0 actually
being released.


Gmane