perl golf

2002-06-13 Thread Phil Carmody
Excuse my ignorance, total newbie... What is the relation between: a) this list b) the perl golf tournament that just had the vowels/letters hole c) the perl golf tournament that currently is doing hamming codes d) the perl golf tournament that did magic squares a few weeks back ? I'd like to kn

Re: perl golf

2002-06-13 Thread Phil Carmody
--- Yanick <[EMAIL PROTECTED]> wrote: > Hope this answers your question. :) It makes more sense than most of the perl that flies by! > > I'd like to know for several reasons: > > 1) Why are the gods of perl-golf not 'members' in the hamming > code > > one, where I, who has no affiliation t

Re: perl golf

2002-06-16 Thread Phil Carmody
--- Rick Klement <[EMAIL PROTECTED]> wrote: > Phil Carmody wrote: > > > > 2) In 2 days time, I'm going to want some pointers from the gurus > on > > the no doubt obvious tweaks that I could make to my hamming entry > - > > is this the place for suc

Re: perl golf

2002-06-16 Thread Phil Carmody
--- Rick Klement <[EMAIL PROTECTED]> wrote: > > The only solution is to use them more... > > Or study the post-mortems from previous games. I always recommend > golfers > study Eugene's rev.pl from Andrew's Santa Challenge: "print the > lines from > an input file in reverse order". Almost everyon

Re: TPR(0,4b) is open

2002-07-01 Thread Phil Carmody
When it says "The tiebreaker favors 1) white space, and then 2) letters." does that mean "more whitespace -> more tiebreaker -> more score -> bad" or "more whitespace -> more favoured -> good" ? Phil = -- "One cannot delete the Web browser from KDE without losing the ability to man

Re: TPR(0,4b) is open

2002-07-01 Thread Phil Carmody
--- Rick Klement <[EMAIL PROTECTED]> wrote: > Chris Dolan wrote: > > > > Rick Klement wrote: > > > > > > And yet another test program: version1.4 > > > > > > Unfortunately we won't be able to get the web page updated > > > for a while, I'll attach it to this message. > > > > > > > Rick, can you

Re: TPR(0,4b) is open

2002-07-01 Thread Phil Carmody
--- Ton Hospel <[EMAIL PROTECTED]> wrote: > In article <[EMAIL PROTECTED]>, > Rick Klement <[EMAIL PROTECTED]> writes: > > > > > > ... > > ... > > .. ... > > . .. > > > > there is a node name '' that is both in a relationship and is > included >

Re: TPR(0,4b) is open

2002-07-01 Thread Phil Carmody
--- Rick Klement <[EMAIL PROTECTED]> wrote: > Ton Hospel wrote: > > > > In article <[EMAIL PROTECTED]>, > > Rick Klement <[EMAIL PROTECTED]> writes: > > > > > > > > > ... > > > ... > > > .. ... > > > . .. > > > > > > there is a node name '' that

Re: TPR(0,4b) is open

2002-07-02 Thread Phil Carmody
--- "F. Xavier Noria" <[EMAIL PROTECTED]> wrote: > I see that point in the rules as a particular case of the fact that > partial orders are not total. Given this input > > a b > c d > e e > > what would be considered as valid outputs? 6 permutations of abcd are possible (..xx, .xx., .x.x both

Re: TPR(0,4b) is open

2002-07-02 Thread Phil Carmody
--- Lars Henrik Mathiesen <[EMAIL PROTECTED]> wrote: > > Date: Mon, 01 Jul 2002 16:21:26 -0700 > > From: Rick Klement <[EMAIL PROTECTED]> > > > > Phil Carmody wrote: > > > --- Rick Klement <[EMAIL PROTECTED]> wrote: > > > >

Re: TPR(0,4b) is open

2002-07-02 Thread Phil Carmody
--- Lars Henrik Mathiesen <[EMAIL PROTECTED]> wrote: > > because > > a b > > b a > > is satisfied by > > a > > b > > and > > b > > a > > in every model. > > > > i.e. It is explicitly _not_ the case that "no possible order of > nodes > > [...] will satisfy the input line requirements"

Re: TPR(0,4b) is open

2002-07-02 Thread Phil Carmody
--- "F.Xavier Noria" <[EMAIL PROTECTED]> wrote: > I guess different > labels > mean different elements, so > > a b > b a > > implies a != b, is not a partial order over the set {a, b}, and as > I > understand it valid output says so. I concede. I believe others have said it all along, but the a

Re: Hurrah! /-\ is a nostril ahead of `/ (yet again)

2002-07-03 Thread Phil Carmody
--- [EMAIL PROTECTED] wrote: > Stop Press. Latest Leaderboard: > /-\ndrew 143.46 > `/anick143.53 > > ^.^ :))) > > BTW, I symphathize with FatPhil. By a process > akin to natural selection, the standard of > golf is definitely going up. The weaker players > are giving up Hoorah - that mea

Re: more minigolf

2002-07-10 Thread Phil Carmody
--- Jasper McCrea <[EMAIL PROTECTED]> wrote: > Michael W Thelen wrote: > > > > On Wed, Jul 10, 2002 at 12:47:40PM +0100, Jasper McCrea wrote: > > > given a line number on the command line, print out that line > from > > > Pascal's triangle. Single space separated numbers, nothing but > a \n at >

Re: more minigolf

2002-07-10 Thread Phil Carmody
--- Chris Dolan <[EMAIL PROTECTED]> wrote: > Attached is a test script which allows either zero or one as the > starting number: > >tritest.pl > > e.g.: > > perl tritest.pl 0 tri_0.pl > > or > > perl tritest.pl 1 tri_1.pl > > My current score (which I hope to improve) is > 0: 56

Re: more minigolf

2002-07-10 Thread Phil Carmody
--- Chris Dolan <[EMAIL PROTECTED]> wrote: > Hope fulfilled: > 0: 49 > 1: 49 > > That's about as low as I can go with my current approach. 0: 51hmmm, clumsy 1: 49likewise, at a dead end Phil = -- "One cannot delete the Web browser from KDE without losing the ability to manage

minigolf

2002-07-10 Thread Phil Carmody
0: 47 1: 47 Phil = -- "One cannot delete the Web browser from KDE without losing the ability to manage files on the user's own hard disk." - Prof. Stuart E Madnick, MIT. So called "expert" witness for Microsoft. 2002/05/02 __ Do You Yahoo!?

Re: minigolf

2002-07-10 Thread Phil Carmody
--- Phil Carmody <[EMAIL PROTECTED]> wrote: > 0: 47 > 1: 47 0: 46 1: 46 _Now_ I think I'm at a dead end, and would require a new algorithm. Phil = -- "One cannot delete the Web browser from KDE without losing the ability to manage files on the user's own h

Re: Iron Man team golf

2002-07-10 Thread Phil Carmody
--- Ton Hospel <[EMAIL PROTECTED]> wrote: > So you think you swing a mean club ? You think you can solve > minigolfs > while still sleeping ? You jump large bunkers in a single stroke ? No, I simply like playing in sand-pits. I know to duck when I hear a shout of 'fore'. > Then try a *HARD* golf

Re: more minigolf

2002-07-11 Thread Phil Carmody
I can't believe people manged to work out how to use regexps to solve this - they looked to complicated for me , so I just went with the simple recurrence! My 2 entries inserted in numerical order. Note - the zero-based one did end up shorter than my one-based one, which counters what I first thou

Re: more minigolf

2002-07-11 Thread Phil Carmody
--- Ton Hospel <[EMAIL PROTECTED]> wrote: > my 41: > print"@{[$w=1,map$w*=$_/--$;,-pop..-1]}\n" My 44 shares an awful lot with that, but I just don't understand yours. What is @{[ ... ]} ? It's not in perlsyn, perlop, perlvar ... (hmmm, I must see if my 44 and 46 can be made shorter using

Re: more minigolf

2002-07-11 Thread Phil Carmody
--- Chris Dolan <[EMAIL PROTECTED]> wrote: > Phil Carmody wrote: > > > > What is > > @{[ ... ]} > > ? > > > > It's not in perlsyn, perlop, perlvar ... > > > > It's like this: > > $ref = [$w=1,map$w*=$_/--$;,-pop

Re: more minigolf

2002-07-11 Thread Phil Carmody
--- Ton Hospel <[EMAIL PROTECTED]> wrote: > Another fun thing of my solution is that the value printed first is > a copy > of the value printed last, NOT the 1 that gets assigned originally. > (as you can see by trying print"@{[$w=1,map$w*=$_/--$n,-pop..-2]}\n") Amazing. I've gone from not under

Re: more minigolf

2002-07-12 Thread Phil Carmody
--- Ton Hospel <[EMAIL PROTECTED]> wrote: > In article > <[EMAIL PROTECTED]>, > [EMAIL PROTECTED] writes: > >> Does anyone else want to claim a golf trick? > I claim: > $|-- and --$| as toggle. > ~- as a prefix -1 construct (e.g. in ~-pop) > > I would be surprised if these weren't know

Re: more minigolf

2002-07-12 Thread Phil Carmody
--- [EMAIL PROTECTED] wrote: > En op 12 juli 2002 sprak FatPhil: > > print"@{[$w=1,map$w*=$_/--$n,-pop..-2]}\n") > > Please - noone feed me any more information - it might trip > > the balance the other way again! :-| > > > > Truly not of this earth... > > Though Ton is not of this earth, the @{

Re: more minigolf

2002-07-12 Thread Phil Carmody
--- [EMAIL PROTECTED] wrote: > En op 12 juli 2002 sprak FatPhil: > > So I'd call it a high-precedence -1 trick rather than a > > prefix -1 trick. > > I think the main point of Ton's trick is to get around > that annoying "use of pop without parens is ambiguous" > error message when you use: > p

Re: a little shorter please?

2002-07-22 Thread Phil Carmody
--- Steffen Mueller <[EMAIL PROTECTED]> wrote: > [ > Crossposted to perl.fwp and perl.golf. Reply to set to perl.golf. > Hope the > newsreader won't fsck it up. :) > ] > > "Aaron J Mackey" <[EMAIL PROTECTED]> schrieb... > > > I can't seem to get this any shorter: I want the second through > the

Re: a little shorter please?

2002-07-22 Thread Phil Carmody
--- Steffen Mueller <[EMAIL PROTECTED]> wrote: > "Phil Carmody" <[EMAIL PROTECTED]> schrieb... > > > "Aaron J Mackey" <[EMAIL PROTECTED]> schrieb... > > > > I can't seem to get this any shorter: I want the second > > > &

this must be golfable

2002-08-11 Thread Phil Carmody
Either direction, or both. Fed from stdin or command-line, I'm not fussy. Just something that's a "one liner" that works would be cool. ___ | o . o| | oo o.oo | | oo .o | | o . | | oo .o | | oo o.ooo| | oo o.oo | | o .ooo| | ooo .o | | o . | | ooo .o o| | ooo . oo| | oo

Re: this must be golfable

2002-08-11 Thread Phil Carmody
One way: perl -pe '$_=y/o |./10/d?pack(B8,$_):""' Phil --- Phil Carmody <[EMAIL PROTECTED]> wrote: > ___ > | o . o| > | oo o.oo | > | oo .o | [SNIP] > > <-> > > And don't use ASCII = -- The good Christian s

Re: this must be golfable

2002-08-11 Thread Phil Carmody
--- Eugene van der Pijll <[EMAIL PROTECTED]> wrote: > And on 11 sextil 2002 said Phil Carmody: > > One way: > > > > perl -pe '$_=y/o |./10/d?pack(B8,$_):""' I'd just realised perl -pe '$_=y/o |./10/d&&pack(B8,$_)'

Re: this must be golfable

2002-08-11 Thread Phil Carmody
I've heard mention of IRC. What net (what server's good for Finns?) and what channel? Chz, Phil = -- The good Christian should beware of mathematicians, and all those who make empty prophecies. The danger already exists that the mathematicians have made a covenant with the devil to darke

Re: perl <= 5.6 core

2002-10-06 Thread Phil Carmody
--- Paul Johnson <[EMAIL PROTECTED]> wrote: > I golfed the bug down to perl -e 'map { 1 for () } 1 .. 2' :-) I guess that was my first experience of golf - I used to submit minimal criminals to TI's compiler division after my fellow coders had given me entire files that failed to compile correctl

Re: Anti-golfing

2002-10-27 Thread Phil Carmody
--- Ton Hospel <[EMAIL PROTECTED]> wrote: > In article <[EMAIL PROTECTED]>, > Peter Makholm <[EMAIL PROTECTED]> writes: > > In a momentary[0] insanity I came up with the concept of anti-golf. > Can't be done. Yup. > e.g. I can convert the program to a turing machine and run it on that. > t

Re: A new golf "Automatic Editing" has started

2003-08-30 Thread Phil Carmody
--- Ronald J Kimball <[EMAIL PROTECTED]> wrote: > On Fri, Aug 29, 2003 at 10:27:10PM -, Mtv Europe wrote: > > Hello Daniel! > > > > [EMAIL PROTECTED] (Daniel Tiefnig) wrote: > > > > > Well, you could still say "a" -> "a".. > > > > Nope, it's not permitted. Generic rule #2, "The program is

shootout!

2003-09-10 Thread Phil Carmody
Do any of you gurus have anything to say about the regexp shootout at: http://www.bagley.org/~doug/shootout/bench/regexmatch/ including the perl contender: http://www.bagley.org/~doug/shootout/bench/regexmatch/regexmatch.perl ? Phil = Given that Dubya has control of a such vast arsenal,

Re: shootout!

2003-09-10 Thread Phil Carmody
--- Ala Qumsieh <[EMAIL PROTECTED]> wrote: > http://www.bagley.org/~doug/shootout/bench/regexmatch/regexmatch.perl > > ? > > I couldn't understand what's the purpose of the > shootout? Performance? Character count? Their purpose was performance. Perl was a bit far down the list of results, IMHO.

Re: shootout!

2003-09-11 Thread Phil Carmody
--- Ronald J Kimball <[EMAIL PROTECTED]> wrote: > > Their purpose was performance. Perl was a bit far down the list of results, > > IMHO. However, I thought that it should all be squeezed onto one line at the > > same time as making it faster through regexp trickery perhaps. > > For example, it too

HTML de-uglifier in 2 lines of perl

2003-10-10 Thread Phil Carmody
#!/usr/bin/perl -n chomp;if($#p>=0&&s/^(\"?>)//){$p[-1].="$1\n";print(join($w<70?' ':"\n",@p));@p=($_);$w=0} [EMAIL PROTECTED],$_}$w+=length;}{print(join("\n",@p))if($#p>=0); I wrote that because docbook2html produces ugly HTML: <<< A World Wide Web Interface to CTAN>> and I wanted (IMHO) prett

Re: perlrun -aF

2003-11-12 Thread Phil Carmody
--- Tor Hildrum <[EMAIL PROTECTED]> wrote: > Hi there, I just have a little peculiarity that I am wondering about. > > The following code works as expected: > #!/usr/bin/perl > > while(<>) > { > @F = split(''); > > print map unpack("B8",$_),@F; > } > > Test run: > tor% ./test.pl > ab

Linus sequence

2003-12-18 Thread Phil Carmody
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 minimised at each stage. The code's

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

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: Shortest non-numeric Perl expression for each number

2004-03-10 Thread Phil Carmody
--- Andrew Savige <[EMAIL PROTECTED]> wrote: > I'm interested to learn the shortest Perl expression for each > number -- but without using any numbers. Here's what I've come > up with so far. Improvements welcome. Oh, and please feel free > to extend the table below ($X[60] being especially juicy;-

Feel free to shrink this bit of silliness

2005-01-07 Thread Phil Carmody
I threw this together last night just for fun, and I reckon that it could probably be made pretty tiny; particularly if the numeric command-line arguments were ditched and turned into constants (24 lines of 72 chars, say), and maybe if the selection of sweetie types was scrapped, and just '@' use

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: 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 PROTE

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|$))*$/ Kiito

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/^((.*)(.*) > > > &

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 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

regexp quickie

2007-06-27 Thread Phil Carmody
Say I had a string satisfying /^[A-Z_]{6}$/, but not equal to '__' and I wish to extract from that the 1 or 2 letters which are closest to the n-th character in the string. Is there a simple regexp to perform that task? e.g. if the string=A_Z_K_ then: if n=1, then I want 'A' (or 'AA', not fuss

Re: regexp quickie

2007-06-27 Thread Phil Carmody
--- Ronald J Kimball <[EMAIL PROTECTED]> wrote: > On Wed, Jun 27, 2007 at 05:45:54AM -0700, Phil Carmody wrote: > > Say I had a string satisfying /^[A-Z_]{6}$/, but not equal to '__' > > and I wish to extract from that the 1 or 2 letters which are closest t

RE: regexp quickie

2007-06-27 Thread Phil Carmody
--- [EMAIL PROTECTED] wrote: > Mine (borrowing RJK's testing code): $1 will be the last letter > (non-underscore) before or at the target location; $2 will be the first > letter at or after the target location, or the last letter if no such letter > exists. > > for (qw/ A_Z_K_ A_ _K /) { >

Re: regexp quickie

2007-06-28 Thread Phil Carmody
--- Shlomi Fish <[EMAIL PROTECTED]> wrote: > On Thursday 28 June 2007, Phil Carmody wrote: > > You guys amaze me! (And gals, too, in case Abigail reads this list. > > Sorry to disappoint you but Abigail is a guy (at least in the context of > Perl): ... > http://ww

Just chipping in...

2007-11-15 Thread Phil Carmody
I saw this on sci.math, and thought "one liner" ;-) I even think a DP non-recursive approach should be quite quick. Keeping the output in the logical order might cost a few strokes. #!/usr/bin/perl $count = $ARGV[0]; print join "\n", pren($count), ""; sub pren { my @list = (); (my $n

Re: Just chipping in...

2007-11-19 Thread Phil Carmody
--- Tuomo Salo <[EMAIL PROTECTED]> wrote: > -BEGIN PGP SIGNED MESSAGE- > - From the keyboard of Phil Carmody (2007-11-15 15:05): > > I saw this on sci.math, and thought "one liner" ;-) > > While I could not squeeze this down to a one 80 char line, ther

In these times of economic crisis...

2009-04-26 Thread Phil Carmody
We need dollar-free golf! In order to answer the question "what ratio of words in the SOWPODS wordlist share no letters in common with the word mackerel?", I quickly threw this together: perl -ne '$c[m/[mackrel]/]++;}print($c[1]/$.,$/);{' < sowpods However, there were complaints that it had

Re: In these times of economic crisis...

2009-04-26 Thread Phil Carmody
--- On Sun, 4/26/09, robert wilson wrote: > Phil Carmody wrote: > > We need dollar-free golf! > > > > In order to answer the question "what ratio of words > in the SOWPODS wordlist share no letters in common with the > word mackerel?", I quickly threw

Another one-liner?

2009-06-24 Thread Phil Carmody
I needed to remove blank-line-separated chunks of code from a text file if those chunks contained any lines which were 'too long'. So in glorious hyper-verbose mode, I did the following: #!/usr/bin/perl -wT my $MAXLEN=65535; my @chunk=(); my $maxlen=0; while(<>) { if(m/\S/) {

Re: Another one-liner?

2009-06-24 Thread Phil Carmody
--- On Wed, 6/24/09, yan...@babyl.dyndns.org wrote: > +0100, Jasper wrote: > > 2009/6/24 Daniel Tiefnig : > > > > > > ?perl -00 -ne'/.{65535}/||print' > > > > > > > of course becomes > > > > perl -00 -pe'$_ x=!/.{65535}/' > >     I'm probably overlooking something > silly, but > >     perl -O