Re: simple golf for fun

2007-01-17 Thread Phil Carmody
--- Ronald J Kimball <[EMAIL PROTECTED]> wrote: > On Tue, Jan 16, 2007 at 04:59:51PM -0800, Phil Carmody wrote: > > --- Juho Snellman <[EMAIL PROTECTED]> wrote: > > > Phil Carmody <[EMAIL PROTECTED]> writes: > > > > -p0 s/^((.*)(.*) > > > > (?=\2.\3 > > > > |$))*$// > > > > > > Assuming the last l

Re: simple golf for fun

2007-01-17 Thread Ton Hospel
In article <[EMAIL PROTECTED]>, Phil Carmody <[EMAIL PROTECTED]> writes: > $ echo -e "1\n12\n173\n" | perl -n0 -e 'a//^((.*)(.* > )(?=\2.\3|$))*$/' > Illegal division by zero at -e line 1, <> chunk 1. Yes, it was the expected failure outcome > > Unfortunately it looks like it fails to ev

Re: simple golf for fun

2007-01-17 Thread Juho Snellman
Phil Carmody <[EMAIL PROTECTED]> writes: > 1//regexp/ would crash on the same thing that s/regexp// fails to blank. > So I thought that might be the intended (not space-saving) technique with > a rather bizarre unnecessary use of an unquoted literal to add confusion! > But a typo seems to make more

Re: simple golf for fun

2007-01-17 Thread Phil Carmody
--- Ton Hospel <[EMAIL PROTECTED]> wrote: > -p0 s/\G(.*)(.* > )(?=\1.\2|$)//g > > This should be about as efficient as a simple regex > approach gets. It's also the shortest yet :-) > It outputs starting from the first line that can't > be extended. No output means all lines work. Excellent! That

Re: simple golf for fun

2007-01-17 Thread Daniel Tiefnig
Ton Hospel wrote: > -p0 s/\G(.*)(.* )(?=\1.\2|$)//g > > This should be about as efficient as a simple regex approach gets. > It's also the shortest yet :-) It outputs starting from the first > line that can't be extended. No output means all lines work. If you're free to output whatever you want

Re: simple golf for fun

2007-01-17 Thread Ton Hospel
In article <[EMAIL PROTECTED]>, Phil Carmody <[EMAIL PROTECTED]> writes: > There seemed to be a bug in previous versions (though to be honest not a > serious one, one that could be considered as inviting a loosening of the > specification) - if you added an extra blank line between two real

Re: simple golf for fun

2007-01-17 Thread Ton Hospel
In article <[EMAIL PROTECTED]>, Daniel Tiefnig <[EMAIL PROTECTED]> writes: > If you're free to output whatever you want on mismatch, you can also > just omit the "\G". > > -p0 s/(.*)(.* > )(?=\1.\2|$)//g > > Will print all lines that preceed invalid changes. (As requested!) One > can crea

Re: simple golf for fun

2007-01-17 Thread Phil Carmody
--- Ton Hospel <[EMAIL PROTECTED]> wrote: > By the way, what these programs don't check is if the first line is a > single character. The challenge statement is unclear on if the first > line should be seen as an extension of a ghost empty line or not. Not a requirement. This lets me check slices

Re: simple golf for fun

2007-01-17 Thread Ronald J Kimball
On Wed, Jan 17, 2007 at 01:25:20PM +0200, Juho Snellman wrote: > Phil Carmody <[EMAIL PROTECTED]> writes: > > 1//regexp/ would crash on the same thing that s/regexp// fails to blank. > > So I thought that might be the intended (not space-saving) technique with > > a rather bizarre unnecessary use o

Re: New Golf

2007-01-17 Thread Daniel Cutter
I was just wondering, reading all your talk about your solutions to the fonality golf, I would assume that everyone converted in arabic, calculated and then converted back to roman. When I first had a look at the problem I thought that that would be the obvious way to do it. At the time I thoug

Re: New Golf

2007-01-17 Thread Jasper
On 1/17/07, Daniel Cutter <[EMAIL PROTECTED]> wrote: I was just wondering, reading all your talk about your solutions to the fonality golf, I would assume that everyone converted in arabic, calculated and then converted back to roman. When I first had a look at the problem I thought that that wou

Re: New Golf

2007-01-17 Thread Andrew Savige
--- Jasper wrote: > p.s. > for($f=12;$f-->0;){ > surely > for($f=12;--$f;){ > ? p.p.s. Mr Magoo. I think you meant for($f=12;$f--;) For cheap thrills, I fixed a few more Magoos, whittling dcutter's 247 to 237: #!perl -aln @a=(IV,IX,XL,XC,CD,CM,M,D,C,L,X,V);@b=(I,VI,X,LX,C,DC,DD,CC,LL,XX,VV,II);s

Re: New Golf

2007-01-17 Thread Ton Hospel
In article <[EMAIL PROTECTED]>, Daniel Cutter <[EMAIL PROTECTED]> writes: > I was just wondering, reading all your talk about your solutions to the > fonality golf, I would assume that everyone converted in arabic, > calculated and then converted back to roman. When I first had a look at >