in reply to Re^2: Challenge: prefix($x, $y) . suffix($x, $z) eq $x
in thread Challenge: prefix($x, $y) . suffix($x, $z) eq $x

I do see a syntax error

Thanks, corrected. - I seem to just have learned something about index: use it! Did cut the wallclock time to the half it did... ;-) ... see my update.

  • Comment on Re^3: Challenge: prefix($x, $y) . suffix($x, $z) eq $x

Replies are listed 'Best First'.
Re^4: Challenge: prefix($x, $y) . suffix($x, $z) eq $x
by Limbic~Region (Chancellor) on Apr 22, 2009 at 22:35 UTC
    shmem,
    This doesn't seem to scale very well. I started to run it against a 60K word dictionary file and I gave up waiting for it to produce output after a few minutes. Perhaps you could modify it to accept a target word from the command line and only do all matches if one isn't provided?

    Cheers - L~R

      Limbic~Region,

      well, it was never meant to scale ;-)
      I've updated my post. Running it with 'ivanova' as argument now yields

      real 0m0.067s user 0m0.051s sys 0m0.003s

      on average.

      --shmem

        shmem,
        Much better - but it helped me find another bug in your code.
        $perl shmem.pl hello found: prefix(haughtiness humanoid ... hello

        prefix(hello, hello) ne 'h' for a number of reasons. First, they have more in common then h. Second, it would consume the entire word - both of which are against the rules.

        Cheers - L~R