Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Re: Re: Golf (Inspired): Repeated Phrases

by MeowChow (Vicar)
on May 10, 2001 at 20:40 UTC ( #79466=note: print w/ replies, xml ) Need Help??

in reply to Re: Golf (Inspired): Repeated Phrases
in thread Golf (Inspired): Repeated Phrases

I don't think this works quite right. Compare the output from the following two runs:

@l = repeated('this dog a round', 'this dog a pound', 1, 3); @l = repeated('this dog a round', 'this dog a pound', 1, 4);
UPDATE: Here's an 85-byte version that returns all the matches:
sub repeated { ($s,$_,$m,$n)=@_;my@p;for$i($m..$n){$s=~$1&&push@p,$&while/\b(?=((\w+\ +b ?){$i}))/g}@p }
               s aamecha.s a..a\u$&owag.print

Comment on Re: Re: Golf (Inspired): Repeated Phrases
Select or Download Code

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://79466]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2015-11-29 07:09 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (748 votes), past polls