Re: Linus sequence

2003-12-19 Thread Phil Carmody
--- Ton Hospel <[EMAIL PROTECTED]> wrote: > In article <[EMAIL PROTECTED]>, > [EMAIL PROTECTED] (Ton Hospel) writes: > > In article <[EMAIL PROTECTED]>, > > [EMAIL PROTECTED] (Ton Hospel) writes: > >> In article <[EMAIL PROTECTED]>, > >>[EMAIL PROTECTED] (Ton Hospel) writes: > >>> per

Re: Linus sequence

2003-12-19 Thread Ton Hospel
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Ton Hospel) writes: > In article <[EMAIL PROTECTED]>, > [EMAIL PROTECTED] (Ton Hospel) writes: >> In article <[EMAIL PROTECTED]>, >> [EMAIL PROTECTED] (Ton Hospel) writes: >>> perl -le '[EMAIL PROTECTED]@!~/(.*)(1|2)\1$/||3-$2for

Re: Linus sequence

2003-12-19 Thread Ton Hospel
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Ton Hospel) writes: > In article <[EMAIL PROTECTED]>, > [EMAIL PROTECTED] (Ton Hospel) writes: >> perl -le '[EMAIL PROTECTED]@!~/(.*)(1|2)\1$/||3-$2for 0..98' > and of course: > perl -le '[EMAIL PROTECTED]@!~/(.*)(.)\1$/||3-$2for 0..9

Re: Linus sequence

2003-12-19 Thread Ton Hospel
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Ton Hospel) writes: > perl -le '[EMAIL PROTECTED]@!~/(.*)(1|2)\1$/||3-$2for 0..98' and of course: perl -le '[EMAIL PROTECTED]@!~/(.*)(.)\1$/||3-$2for 0..98'

RE: Linus sequence

2003-12-19 Thread Allen, Greg
Oh! Oh! Magoo! 1|2 -> . perl -le '[EMAIL PROTECTED]@!~/(.*)(.)\1$/||3-$2for 0..98' PS. Ton is god of perl golf. Greg -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Friday, December 19, 2003 6:19 PM To: [EMAIL PROTECTED] Subject: Re: Linus se

Re: Linus sequence

2003-12-19 Thread Ton Hospel
perl -le '[EMAIL PROTECTED]@!~/(.*)(1|2)\1$/||3-$2for 0..98'

Re: Linus sequence

2003-12-19 Thread Jasper McCrea
Rick Klement wrote: > > Phil Carmody wrote: > > > > Embarassment time - > > perl -e > > '"${s}1_${s}2"=~/(.*)\1_.*?(.*)\2$/,print$s.=1+(length$1>length$2),$/for(0..98)' > > > > The task was to produce the "Linus sequence" where either a 1 or a 2 is added > > to the seed "1", such that the contiguo

Re: Linus sequence

2003-12-18 Thread Keith C. Ivey
Phil Carmody <[EMAIL PROTECTED]> wrote: > > 2. Use a punctuation variable (like $,) instead of $s, so that > >you don't have to use the braces when interpolating. > > I tried that with one punctuation variable, but it didn't work, > it appears that assignment to it refused to accept strings,

Re: Linus sequence

2003-12-18 Thread Rick Klement
Phil Carmody wrote: > > Embarassment time - > perl -e > '"${s}1_${s}2"=~/(.*)\1_.*?(.*)\2$/,print$s.=1+(length$1>length$2),$/for(0..98)' > > The task was to produce the "Linus sequence" where either a 1 or a 2 is added > to the seed "1", such that the contiguous repeat at end of the string is > m

Re: Linus sequence

2003-12-18 Thread Phil Carmody
--- "Keith C. Ivey" <[EMAIL PROTECTED]> wrote: > Phil Carmody <[EMAIL PROTECTED]> wrote: > > > perl -e > > '"${s}1_${s}2"=~/(.*)\1_.*?(.*)\2$/,print$s.=1+(length$1>length$ > > 2),$/for(0..98)' > > > Anyone got a few pointers for improving it? > > A few easy points (total savings of 7): > > 1. U

Re: Linus sequence

2003-12-18 Thread Keith C. Ivey
Phil Carmody <[EMAIL PROTECTED]> wrote: > perl -e > '"${s}1_${s}2"=~/(.*)\1_.*?(.*)\2$/,print$s.=1+(length$1>length$ > 2),$/for(0..98)' > Anyone got a few pointers for improving it? A few easy points (total savings of 7): 1. Use 'perl -le' and eliminate the ',$/' to get the newline. 2. Use a pu