simple golf for fun

2007-01-16 Thread Phil Carmody
This is a real world task which can be solved in a couple of lines. Which makes me think that you guys can do it in about half a line! The simple version of the task is to verify that each line of a file is the insertion of one character somewhere (maybe at the start or the end) into the prior li

Re: New Golf

2007-01-16 Thread Andy_Bach
> My first thought was HART: Hospelian Arabic to Roman Transform. >Remembering this old "ton is an alien" thread, I now propose "Earthman": Eye-popping Alien Roman Ton Hospelian Magical Algorithm for Numerals > If you can think of a better name, please let us know. :-) I don't know of any val

Re: simple golf for fun

2007-01-16 Thread Yanick Champoux
Phil Carmody said: > This is a real world task which can be solved in a couple of lines. > Which makes me think that you guys can do it in about half a line!

Re: simple golf for fun

2007-01-16 Thread Yanick Champoux
Phil Carmody said: > This is a real world task which can be solved in a couple of lines. > Which makes me think that you guys can do it in about half a line! Not exactly half a line, but still not too bad: #!perl -lp $p=~s/\B|\b/(.)?/g;/^$p$/; $p=$_;$_=(@m=grep/./,@-)[EMAIL PROTECTED]:die"brok

Re: simple golf for fun

2007-01-16 Thread Ton Hospel
In article <[EMAIL PROTECTED]>, Phil Carmody <[EMAIL PROTECTED]> writes: > This is a real world task which can be solved in a couple of lines. > Which makes me think that you guys can do it in about half a line! > > The simple version of the task is to verify that each line of a file is t

Re: simple golf for fun

2007-01-16 Thread Phil Carmody
In response to Phil Carmody <[EMAIL PROTECTED]> saying: > > The simple version of the task is to verify that each line of a file is the > > insertion of one character somewhere (maybe at the start or the end) into > > the prior line. --- Ton Hospel <[EMAIL PROTECTED]> wrote: <<< -p0 $_ x=/^((.*)(

Re: simple golf for fun

2007-01-16 Thread Ton Hospel
In article <[EMAIL PROTECTED]>, Phil Carmody <[EMAIL PROTECTED]> writes: > In response to Phil Carmody <[EMAIL PROTECTED]> saying: >> > The simple version of the task is to verify that each line of a file is the >> > insertion of one character somewhere (maybe at the start or the end) into

Re: simple golf for fun

2007-01-16 Thread Juho Snellman
Phil Carmody <[EMAIL PROTECTED]> writes: > -p0 s/^((.*)(.*) > (?=\2.\3 > |$))*$// Assuming the last line is also newline-terminated: -n0 a//^((.*)(.* )(?=\2.\3|$))*$/ -- Juho Snellman

Re: simple golf for fun

2007-01-16 Thread Phil Carmody
--- Juho Snellman <[EMAIL PROTECTED]> wrote: > Phil Carmody <[EMAIL PROTECTED]> writes: > > -p0 s/^((.*)(.*) > > (?=\2.\3 > > |$))*$// > > Assuming the last line is also newline-terminated: Fair assumption > -n0 a//^((.*)(.* > )(?=\2.\3|$))*$/ Kiitos, Juho. That's gone beyond my perl ken! Was

Re: simple golf for fun

2007-01-16 Thread Ronald J Kimball
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 line is also newline-terminated: > > Fair assumption > > > -n0