Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: PGA Golf, Round 1 - Results

by japhy (Canon)
on Jun 01, 2001 at 02:34 UTC ( #84776=note: print w/ replies, xml ) Need Help??


in reply to PGA Golf, Round 1 - Results

I disagree on #3's minimum score, as seen by my comments in my answer:

# 3 -- 23 chars # note: using $ instead of \z is *wrong* # note: using . without /s is *wrong* sub g3 { pop=~/^(.*?)\1+\z/s&&$1 }
For that matter, par is 22:
sub g3 { pop=~/^(.*?)\1+\z/s;$1 }


japhy -- Perl and Regex Hacker


Comment on Re: PGA Golf, Round 1 - Results
Select or Download Code
Re (tilly) 2: PGA Golf, Round 1 - Results
by tilly (Archbishop) on Jun 01, 2001 at 02:42 UTC
    Agreed. 22 is the best that I have.

    For a bit I mistakenly thought I had a 20 char solution in the form of:

    sub hole{map/^(.*?)\1+\z/s,@_}
    but the rules say that if a single thing is returned, then it will be in scalar context. In scalar context this solution is wrong (as I indicated in an "oops" update).
Re: Re: PGA Golf, Round 1 - Results
by chipmunk (Parson) on Jun 01, 2001 at 05:46 UTC
    Yup, this is another one of those tricky edge cases... which the committee missed completely! We forgot about newlines in the strings.
Re: Re: PGA Golf, Round 1 - Results
by jmcnamara (Monsignor) on Jun 01, 2001 at 13:20 UTC

    I disagree on #3's minimum score, as seen by my comments in my answer:

    I noted this when you first posted it. I tried to account for it by adding 2 chars to the posts that had omitted \z and /s. However, I didn't get it right in all cases.

    Although, the PGA questions were well specified, it is always possible to miss a boundary condition like this. I should have modified the question to either make this requirement explicit or to specify that it wasn't required.

    John.
    --

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://84776]
help
Chatterbox?
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: (9)
As of 2014-12-26 06:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (165 votes), past polls