in reply to String Compression Optimization (repeated concatenated subsequences)

Have a look at Data::Dump. In its stringification routine (quote()) it does this:

if (length($_) > 20) { # Check for repeated string if (/^(.{1,5}?)(\1*)$/s) { my $base = quote($1); my $repeat = length($2)/length($1) + 1; return "($base x $repeat)"; } }

I imagine you could do something similar.


---
demerphq

    First they ignore you, then they laugh at you, then they fight you, then you win.
    -- Gandhi

    Flux8


  • Comment on Re: String Compression Optimization (repeated concatenated subsequences)
  • Download Code