perl.golf http://www.nntp.perl.org/group/perl.golf/ Re: Hospelian Arabic to Roman Transform (HART) shortened by Yanick Champoux

From: Yanick Champoux On 12-12-25 02:04 AM, Andrew Savige wrote:
> Continuing the thread from Jan 2007 after more than five years,
> the famous "Hospelian Arabic to Roman Transform" aka HART, as
> played by Ton in the Fonality Christmas golf challenge, has been
> shortened by one stroke by primo.

Holy schmolee. I now have this mental image of primo looking at his
monitor, dust gathering in the deep frown above his staring eyes, as the
five years trickle by, until the moment he went 'ah AH!', and shaved
that byte off the prior solution...

Well done,
`/anick

2013-01-02T21:26:35Z
Hospelian Arabic to Roman Transform (HART) shortened by Andrew Savige <p>From: Andrew Savige Continuing the thread from Jan 2007 after more than five years,<br/>the famous &quot;Hospelian Arabic to Roman Transform&quot; aka HART, as<br/>played by Ton in the Fonality Christmas golf challenge, has been<br/>shortened by one stroke by primo. Test program showing Ton&#39;s two<br/>original HART magic formulae and primo&#39;s improvement follows:<br/><br/>use strict;<br/>use Roman;<br/><br/>sub ton1 { my $t = shift; my $s;<br/>($s.=4x$_%1859^7)=~y/IVCXL91-80/XLMCDXVIII/d<br/>for $t=~/./g; return $s }<br/><br/>sub ton2 { my $t = shift; my $s;<br/>($s.=5x$_*8%29628)=~y/IVCXL426(-:/XLMCDIVX/d<br/>for $t=~/./g; return $s }<br/><br/>sub pmo1 { my $t = shift; my $s;<br/>($s.=&quot;32e$_&quot;%72726)=~y/CLXVI60-9/MDCLXVIX/d<br/>for $t=~/./g; return $s }<br/><br/>sub pmo2 { my $t = shift; my $s;<br/>($s.=&quot;57e$_&quot;%474976)=~y/CLXVI0-9/MDCLXIXV/d<br/>for $t=~/./g; return $s }<br/><br/>for my $i (1..3999) {<br/>&nbsp; &nbsp; my $r &nbsp;= uc roman($i);<br/>&nbsp; &nbsp; my $t1 = ton1($i);<br/>&nbsp; &nbsp; my $t2 = ton2($i);<br/>&nbsp; &nbsp; my $p1 = pmo1($i);<br/>&nbsp; &nbsp; my $p2 = pmo2($i);<br/>&nbsp; &nbsp; print &quot;$i: $r\n&quot;;<br/>&nbsp; &nbsp; $r eq $t1 or die &quot;t1: expected &#39;$r&#39; got &#39;$t1&#39;\n&quot;;<br/>&nbsp; &nbsp; $r eq $t2 or die &quot;t2: expected &#39;$r&#39; got &#39;$t2&#39;\n&quot;;<br/>&nbsp; &nbsp; $r eq $p1 or die &quot;p1: expected &#39;$r&#39; got &#39;$p1&#39;\n&quot;;<br/>&nbsp; &nbsp; $r eq $p2 or die &quot;p2: expected &#39;$r&#39; got &#39;$p2&#39;\n&quot;;<br/>}<br/>print &quot;all tests successful\n&quot;;<br/><br/>For more details: http://perlmonks.org/?node_id=1009126<br/><br/>/-\<br/><br/></p> 2012-12-25T07:04:29Z New Golf Server - http://golf.shinh.org/ by Shlomi Fish <p>From: Shlomi Fish Hi all,<br/><br/>there&#39;s a new Golf server called Anarchy Golf, which supports Perl<br/>(perl-5.12.4) and many other languages:<br/><br/>http://golf.shinh.org/<br/><br/>One feature of it is that the solutions are revealed after a while, whose lack<br/>really bothered me in codegolf.com. Its source code is in a GitHub repository<br/>and it has an IRC channel on Freenode.<br/><br/>Regards,<br/><br/> Shlomi Fish<br/><br/>-- <br/>-----------------------------------------------------------------<br/>Shlomi Fish http://www.shlomifish.org/<br/>&quot;The Human Hacking Field Guide&quot; - http://shlom.in/hhfg<br/><br/>&lt;Botje&gt; Khisanth =~ s/must sleep/must give Botje all my money/ .<br/> &mdash; Freenode&rsquo;s #perl<br/><br/>Please reply to list if it&#39;s a mailing list post - http://shlom.in/reply .<br/></p> 2011-12-26T01:13:57Z Re: New series of articles on Code Golf by Andrew Savige <p>From: Andrew Savige Jasper wrote:<br/>&gt; you know, I wish you&#39;d do one of these on the choose golf. Probably a<br/>&gt; very straightforward solution, but at the time I was very annoyed that<br/>&gt; I couldn&#39;t get those extra characters.. codegolf appears to be down<br/>&gt; now so I can&#39;t even be reminded how far off I was.<br/><br/>If it makes you feel any better, I was similarly very annoyed during<br/>that game.&nbsp;codegolf.com has been down for over a week (maybe forever?)<br/>so I can&#39;t even check if I&#39;m ahead of you or not. :)<br/>IIRC we&#39;re tied two or three strokes from the lead. The google cached<br/>page only shows the top ten and you and I are both missing. I notice<br/>that a couple of likely lads (terjek and tybalt89, aka Rick Klement)<br/>both effortlessly&nbsp;found the &quot;obvious&quot; 35 stroke solution though ...<br/>so if they are listening, you might be in luck.<br/><br/>BTW, Rick Klement is the fastest golfer in the west; in the grid<br/>computing challenge, Rick got the lead at 45 within hours but got<br/>complacent. After two weeks of effort I finally caught him on 45,<br/>but then made the fatal mistake of posting a 44 before thoroughly<br/>analysing it. Within an hour or so, I realised I&#39;d missed an easy<br/>43, but too late. Posting that 44 must have provoked Rick; in any<br/>case, he responded to my 44 with a 43 within _minutes_. I was just<br/>about to triumphantly post the &quot;winning&quot; 43 when I noticed, to my<br/>horror,&nbsp;that Rick had beaten me to the punch! Reminded me of the<br/>good old days, just for a little while. :)<br/><br/>/-\<br/><br/></p> 2011-05-18T14:01:40Z Re: New series of articles on Code Golf by Jasper <p>From: Jasper you know, I wish you&#39;d do one of these on the choose golf. Probably a<br/>very straightforward solution, but at the time I was very annoyed that<br/>I couldn&#39;t get those extra characters.. codegolf appears to be down<br/>now so I can&#39;t even be reminded how far off I was..<br/><br/>On 14 May 2011 07:54, Andrew Savige &lt;ajsavige@yahoo.com.au&gt; wrote:<br/>&gt;&gt; This series is now complete with the addition of two bonus episodes:<br/>&gt;&gt;<br/>&gt;&gt; &nbsp;* http://www.perlmonks.org/?node_id=811919 &nbsp;(Part V)<br/>&gt;&gt; &nbsp;* http://www.perlmonks.org/?node_id=814900 &nbsp;(Part VI)<br/>&gt;<br/>&gt; One more: http://www.perlmonks.org/?node_id=903641<br/>&gt;<br/>&gt; Cheers<br/>&gt; /-\<br/>&gt;<br/><br/><br/><br/>-- <br/>Jasper<br/></p> 2011-05-18T08:37:03Z Re: New series of articles on Code Golf by Andrew Savige

From: Andrew Savige > This series is now complete with the addition of two bonus episodes:
>
> * http://www.perlmonks.org/?node_id=811919 (Part V)
> * http://www.perlmonks.org/?node_id=814900 (Part VI)

One more: http://www.perlmonks.org/?node_id=903641

Cheers
/-\

2011-05-13T23:54:44Z
Re: New series of articles on Code Golf by Andrew Savige <p>From: Andrew Savige &gt; I&#39;ve finally completed a series of four articles on code golf, entitled<br/>&gt; &quot;The golf course looks great, my swing feels good, I like my chances&quot;:<br/>&gt;<br/>&gt;&nbsp; * http://www.perlmonks.org/?node_id=759963&nbsp; (Part I)<br/>&gt;&nbsp; * http://www.perlmonks.org/?node_id=761053&nbsp; (Part II)<br/>&gt;&nbsp; * http://www.perlmonks.org/?node_id=762180&nbsp; (Part III)<br/>&gt;&nbsp; * http://www.perlmonks.org/?node_id=763105&nbsp; (Part IV)<br/><br/>This series is now complete with the addition of two bonus episodes:<br/><br/>&nbsp;* http://www.perlmonks.org/?node_id=811919&nbsp; (Part V)<br/>&nbsp;* http://www.perlmonks.org/?node_id=814900&nbsp; (Part VI)<br/><br/>For nostalgia buffs, `/anick et al hardly get a mention this time...<br/>though Jasper is mentioned 26 times.<br/><br/>Enjoy<br/>/-\<br/><br/><br/><br/> __________________________________________________________________________________<br/>See what&#39;s on at the movies in your area. Find out now: http://au.movies.yahoo.com/session-times/<br/><br/></p> 2010-01-02T11:42:55Z Re: anyone have any ideas on how to shorten this? by John W. Krahn

From: John W. Krahn Eric Waguespack wrote:
> this was an attempt to make a password generator that creates the same
> ASCII password every time, given an arbitrary string. (basically 1
> password per website)
>
> this is what i have so far:
>
> echo masterpassword gmail.com | perl -MDigest::SHA -ne '$h = $_; for
> (1..10) { $h=Digest::SHA::sha512_hex("$h") }; $_=$h; while (/(..)/g) {
> $x=$1; $x = int((hex $x) / 2); if( $x ~~ [33..126] ) {print chr($x)};
> END {print "\n";};}' | cut -b1-10

echo masterpassword gmail.com | perl -MDigest::SHA=sha512_hex
-lpe'{$_=sha512_hex($_);++$x<10&&redo}s!(..)!$_=chr
hex($1)/2;y|\41-\177||?$_:""!eg;s/(.)(?=.*?\1)//sg;$_=substr$_,0,10'



John
--
The programmer is fighting against the two most
destructive forces in the universe: entropy and
human stupidity. -- Damian Conway

2009-10-10T11:29:44Z
Re: anyone have any ideas on how to shorten this? by Jasvir Nagra

From: Jasvir Nagra Sure. It wasn't clear what the value of that was other than slowing things
down (which may of course be of value).

On Fri, Oct 9, 2009 at 4:05 PM, Eric Waguespack <ewaguespack@gmail.com>wrote:

> the perl has a loop that rehashes the string 10 times
>
> On Fri, Oct 9, 2009 at 6:02 PM, Jasvir Nagra <jas@nagras.com> wrote:
> > If you have a command line sha1:
> > echo masterpassword gmail.com | sha1sum | perl -alnF'/(..)/' -e
> > '@a=map{$_=chr(hex($_)/2);tr/!-~//cd;$_}@F;print@a'
> > --
> > Jasvir Nagra
> > http://www.cs.auckland.ac.nz/~jas
> >
> >
> > On Fri, Oct 9, 2009 at 2:58 PM, Eric Waguespack <ewaguespack@gmail.com>
> > wrote:
> >>
> >> this was an attempt to make a password generator that creates the same
> >> ASCII password every time, given an arbitrary string. (basically 1
> >> password per website)
> >>
> >> this is what i have so far:
> >>
> >> echo masterpassword gmail.com | perl -MDigest::SHA -ne '$h = $_; for
> >> (1..10) { $h=Digest::SHA::sha512_hex("$h") }; $_=$h; while (/(..)/g) {
> >> $x=$1; $x = int((hex $x) / 2); if( $x ~~ [33..126] ) {print chr($x)};
> >> END {print "\n";};}' | cut -b1-10
> >>
> >> I also want to incorporate this, it removes duplicate characters
> >> (irrespective of location), but my current code doesn't let me just
> >> slip it in.
> >>
> >> $s =~ s[(.)(?=.*?\1)][]g;
> >
> >
>

2009-10-09T16:16:30Z
Re: anyone have any ideas on how to shorten this? by Eric Waguespack

From: Eric Waguespack the perl has a loop that rehashes the string 10 times

On Fri, Oct 9, 2009 at 6:02 PM, Jasvir Nagra <jas@nagras.com> wrote:
> If you have a command line sha1:
> echo masterpassword gmail.com | sha1sum | perl -alnF'/(..)/' -e
> '@a=map{$_=chr(hex($_)/2);tr/!-~//cd;$_}@F;print@a'
> --
> Jasvir Nagra
> http://www.cs.auckland.ac.nz/~jas
>
>
> On Fri, Oct 9, 2009 at 2:58 PM, Eric Waguespack <ewaguespack@gmail.com>
> wrote:
>>
>> this was an attempt to make a password generator that creates the same
>> ASCII password every time, given an arbitrary string. (basically 1
>> password per website)
>>
>> this is what i have so far:
>>
>> echo masterpassword gmail.com | perl -MDigest::SHA -ne '$h = $_; for
>> (1..10) { $h=Digest::SHA::sha512_hex("$h") }; $_=$h; while (/(..)/g) {
>> $x=$1; $x = int((hex $x) / 2); if( $x ~~ [33..126] ) {print chr($x)};
>> END {print "\n";};}' | cut -b1-10
>>
>> I also want to incorporate this, it removes duplicate characters
>> (irrespective of location), but my current code doesn't let me just
>> slip it in.
>>
>> $s =~ s[(.)(?=.*?\1)][]g;
>
>

2009-10-09T16:06:30Z
Re: anyone have any ideas on how to shorten this? by Jasvir Nagra

From: Jasvir Nagra If you have a command line sha1:
echo masterpassword gmail.com | sha1sum | perl -alnF'/(..)/' -e
'@a=map{$_=chr(hex($_)/2);tr/!-~//cd;$_}@F;print@a'

--
Jasvir Nagra
http://www.cs.auckland.ac.nz/~jas


On Fri, Oct 9, 2009 at 2:58 PM, Eric Waguespack <ewaguespack@gmail.com>wrote:

> this was an attempt to make a password generator that creates the same
> ASCII password every time, given an arbitrary string. (basically 1
> password per website)
>
> this is what i have so far:
>
> echo masterpassword gmail.com | perl -MDigest::SHA -ne '$h = $_; for
> (1..10) { $h=Digest::SHA::sha512_hex("$h") }; $_=$h; while (/(..)/g) {
> $x=$1; $x = int((hex $x) / 2); if( $x ~~ [33..126] ) {print chr($x)};
> END {print "\n";};}' | cut -b1-10
>
> I also want to incorporate this, it removes duplicate characters
> (irrespective of location), but my current code doesn't let me just
> slip it in.
>
> $s =~ s[(.)(?=.*?\1)][]g;
>

2009-10-09T16:02:57Z
anyone have any ideas on how to shorten this? by Eric Waguespack

From: Eric Waguespack this was an attempt to make a password generator that creates the same
ASCII password every time, given an arbitrary string. (basically 1
password per website)

this is what i have so far:

echo masterpassword gmail.com | perl -MDigest::SHA -ne '$h = $_; for
(1..10) { $h=Digest::SHA::sha512_hex("$h") }; $_=$h; while (/(..)/g) {
$x=$1; $x = int((hex $x) / 2); if( $x ~~ [33..126] ) {print chr($x)};
END {print "\n";};}' | cut -b1-10

I also want to incorporate this, it removes duplicate characters
(irrespective of location), but my current code doesn't let me just
slip it in.

$s =~ s[(.)(?=.*?\1)][]g;

2009-10-09T14:59:13Z
Re: Another one-liner? by yanick

From: yanick On Wed, Jun 24, 2009 at 06:59:41PM +0200, Eirik Berg Hanssen wrote:
> yanick@babyl.dyndns.org writes:
> > I'm probably overlooking something silly, but
> >
> > perl -O0 -pe's/.{65535,}//'
> >
> > ?
>
> Newlines.

Arrgh. I knew I was forgetting something. Darn, foiled again!

Joy,
`/anick

--

2009-06-25T05:53:14Z
Re: Another one-liner? by Phil Carmody <p>From: Phil Carmody <br/>--- On Wed, 6/24/09, yanick@babyl.dyndns.org &lt;yanick@babyl.dyndns.org&gt; wrote:<br/>&gt; +0100, Jasper wrote:<br/>&gt; &gt; 2009/6/24 Daniel Tiefnig &lt;dantie@gmx.at&gt;:<br/>&gt; &gt; &gt;<br/>&gt; &gt; &gt; ?perl -00 -ne&#39;/.{65535}/||print&#39;<br/>&gt; &gt; &gt;<br/>&gt; &gt; <br/>&gt; &gt; of course becomes<br/>&gt; &gt; <br/>&gt; &gt; perl -00 -pe&#39;$_ x=!/.{65535}/&#39;<br/>&gt; <br/>&gt; &nbsp;&nbsp;&nbsp; I&#39;m probably overlooking something<br/>&gt; silly, but<br/>&gt; <br/>&gt; &nbsp;&nbsp;&nbsp; perl -O0 -pe&#39;s/.{65535,}//&#39;&nbsp; <br/>&gt; &nbsp;&nbsp;&nbsp; <br/>&gt; &nbsp;&nbsp;&nbsp; ?<br/><br/>I love you guys, I really do. I&#39;ll never be a golfer, but I&#39;ll always be a very happy spectator!<br/><br/>Phil<br/><br/><br/><br/></p> 2009-06-24T15:14:17Z Re: Another one-liner? by Philippe Bruhat <p>From: Philippe Bruhat On Wed, Jun 24, 2009 at 04:26:05PM +0100, Jasper wrote:<br/>&gt; 2009/6/24 Daniel Tiefnig &lt;dantie@gmx.at&gt;:<br/>&gt; &gt;<br/>&gt; &gt; &nbsp;perl -00 -ne&#39;/.{65535}/||print&#39;<br/>&gt; &gt;<br/>&gt; <br/>&gt; of course becomes<br/>&gt; <br/>&gt; perl -00 -pe&#39;$_ x=!/.{65535}/&#39;<br/>&gt; <br/><br/>Did you notice that this (x=!) is a secret operator of the same family<br/>as the &quot;screwdriver operators&quot; discovered by Dmitry Karasik and showed<br/>some time ago (November 2007) on fwp.<br/><br/>Actually, Dmitry only showed three of them:<br/><br/>&gt; This bunch, I think, can be appropriately named &quot;screwdriver operators&quot;:<br/>&gt; <br/>&gt; -=! and -=!! - flathead<br/>&gt; +=! and +=!! - phillips<br/>&gt; *=! and *=!! - torx<br/><br/>When preparing my talk on the Perl secret operators for the last French<br/>Perl Workshop (and hopelessly looking for nice pictures of screwdrivers),<br/>I realized that, in real life, there are several types or cruciform<br/>(or cross-head) screwdrivers. It had to be the same in Perl!<br/><br/>Ladies and gentlemen, it is my pleasure to introduce you to the fourth<br/>screwdriver operator, the Pozidriv (http://en.wikipedia.org/wiki/Pozidriv):<br/><br/> x=! and x=!! - pozidriv<br/><br/><br/>This is a conditional &quot;set to empty string&quot; operator (the string<br/>equivalent of the torx):<br/><br/> $x x=!! $y is same as $x = &#39;&#39; unless $y;<br/> $x x=! $y -- $x = &#39;&#39; if $y;<br/><br/><br/>I hope you&#39;ll welcome it in your toolbox, like Jasper did.<br/><br/>-- <br/> Philippe Bruhat (BooK)<br/><br/> The fish most likely to be caught is the one with the biggest mouth.<br/> (Moral from Groo The Wanderer #17 (Epic))<br/></p> 2009-06-24T14:35:42Z Re: Another one-liner? by Daniel Tiefnig

From: Daniel Tiefnig Phil Carmody wrote:
> I needed to remove blank-line-separated chunks of code from a text
> file if those chunks contained any lines which were 'too long'.
[...]
> If you think how little it does, it's got to be one-linerable, no?

Should do the trick:

perl -00 -ne'/.{65535}/||print'

lg,
daniel

2009-06-24T12:22:56Z
Re: Another one-liner? by Daniel Tiefnig

From: Daniel Tiefnig Phil Carmody wrote:
> I needed to remove blank-line-separated chunks of code from a text
> file if those chunks contained any lines which were 'too long'.
[...]
> If you think how little it does, it's got to be one-linerable, no?

Here's one that does split on lines with whitespace too, but is much
less elegant than my first one:

perl -0777 -F'(?<=\n)\s*(?=\n)' -ane'/.{65535}/||print for@F'

Maybe one can save one or the other stroke with a smarter solution of
the newline issue...

lg,
daniel

2009-06-24T11:26:53Z
Re: Another one-liner? by Daniel Tiefnig

From: Daniel Tiefnig Eirik Berg Hanssen wrote:
>> I'm probably overlooking something silly, but
>>
>> perl -O0 -pe's/.{65535,}//'
>
> Newlines.

Besides that I'm getting "Can't do {n,m} with n > m in regex" for values
greater than 2^15 - 1 here.

br,
daniel

2009-06-24T10:43:48Z
Re: Another one-liner? by Eirik Berg Hanssen

From: Eirik Berg Hanssen yanick@babyl.dyndns.org writes:

> On Wed, Jun 24, 2009 at 04:26:05PM +0100, Jasper wrote:
>> 2009/6/24 Daniel Tiefnig <dantie@gmx.at>:
>> >
>> > ?perl -00 -ne'/.{65535}/||print'
>> >
>>
>> of course becomes
>>
>> perl -00 -pe'$_ x=!/.{65535}/'
>
> I'm probably overlooking something silly, but
>
> perl -O0 -pe's/.{65535,}//'
>
> ?

Newlines.


Eirik
--
Perl programmers do it more than one way

2009-06-24T09:59:56Z
Re: Another one-liner? by yanick

From: yanick On Wed, Jun 24, 2009 at 04:26:05PM +0100, Jasper wrote:
> 2009/6/24 Daniel Tiefnig <dantie@gmx.at>:
> >
> > ?perl -00 -ne'/.{65535}/||print'
> >
>
> of course becomes
>
> perl -00 -pe'$_ x=!/.{65535}/'

I'm probably overlooking something silly, but

perl -O0 -pe's/.{65535,}//'

?

Joy,
`/anick

2009-06-24T09:50:58Z
Re: Another one-liner? by Jasper <p>From: Jasper 2009/6/24 Daniel Tiefnig &lt;dantie@gmx.at&gt;:<br/>&gt;<br/>&gt; &nbsp;perl -00 -ne&#39;/.{65535}/||print&#39;<br/>&gt;<br/><br/>of course becomes<br/><br/>perl -00 -pe&#39;$_ x=!/.{65535}/&#39;<br/><br/>-- <br/>Jasper<br/></p> 2009-06-24T08:26:18Z Re: Another one-liner? by Daniel Tiefnig

From: Daniel Tiefnig Phil Carmody wrote:
> I needed to remove blank-line-separated chunks of code from a text
> file if those chunks contained any lines which were 'too long'.
[...]
> If you think how little it does, it's got to be one-linerable, no?

Duh, wrong e-mail address, sorry if solutions show up twice now after a
while...

Should do the trick if paragraphs are separated by *empty* lines:

perl -00 -ne'/.{65535}/||print'

Here's one that does split on lines with whitespace too, but is much
less elegant than my first one:

perl -0777 -F'(?<=\n)\s*(?=\n)' -ane'/.{65535}/||print for@F'

Maybe one can save one or the other stroke with a smarter solution of
the newline issue...

lg,
daniel

2009-06-24T08:05:11Z
Another one-liner? by Phil Carmody

From: 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/)
{
if(length($_)>$maxlen) { $maxlen=length($_); }
push(@chunk, $_) if($maxlen<$MAXLEN);
}
else
{
if($maxlen<$MAXLEN and @chunk)
{
print(@chunk, $_);
}
@chunk = ();
$maxlen = 0;
}
}

If you think how little it does, it's got to be one-linerable, no?

The 65535 is a bit arbitrary. Feel free to use anything between 1e5 and that.

Phil



2009-06-24T06:02:53Z
Re: New series of articles on Code Golf by Andrew Savige <p>From: Andrew Savige <br/>`/anick wrote:<br/><br/>&gt;&nbsp;do you remember how Stephen Turner discovered &#39;www.googlism.com&#39;, way back in 2002?<br/><br/>Though I failed to trick googlism with `/anick, I see I accidentally succeeded with<br/>Amir Karger, for www.googlism.com reports:<br/><br/>&nbsp;amir karger is my tortoise<br/><br/>which seems to be an abbreviated form of the original:<br/><br/>&nbsp;Amir Karger is my tortoise-crawling hero<br/><br/>Ah, the good old days.<br/><br/>/-\<br/><br/><br/><br/><br/></p> 2009-05-11T04:15:26Z Re: New series of articles on Code Golf by Andrew Savige <p>From: Andrew Savige <br/>`/anick wrote:<br/>&gt; Well, to this very day, social network crawlers all over the Net are prone<br/>&gt; to list me as a professor of psycho-sexual research at a great European<br/>&gt; University.<br/><br/>Drat,&nbsp;didn&#39;t fool googlism. But pipl.com, at least, believed me:<br/><br/>&nbsp;http://pipl.com/directory/people/Yanick/Champoux<br/><br/>They also link to other golfers, I see:<br/><br/>&nbsp;&quot;keith ivey is senior producer for the laguna hills&quot;<br/>&nbsp;&quot;ton hospel is on 52&quot;<br/>&nbsp;&quot;rick klement is the only golfer to have played 7/7&quot;<br/>&nbsp;&quot;michael thelen is my hero&quot;<br/>&nbsp;&quot;michael thelen is *not* my hero&quot;<br/><br/>Let&#39;s try again, with a great European University at the home of golf:<br/><br/>&nbsp;Yanick Champoux is professor of psycho-sexual research<br/>&nbsp;at the University of St Andrews.<br/><br/>And since you mentioned Stephen Turner, I _really_ miss his signature.<br/><br/>/-\<br/>--<br/>&quot;This is Henman&#39;s 8th Wimbledon, and he&#39;s only lost 7 matches.&quot; BBC, 2/Jul/01<br/><br/><br/><br/><br/></p> 2009-05-11T03:53:37Z Re: New series of articles on Code Golf by Yanick Champoux

From: Yanick Champoux Andrew Savige wrote:
> For nostalgia buffs, Eugene, Ton, Mtv, ... even `/anick all get
> a mention. :-)

Aaah... Nostalgia indeed. Those were the good ol' days...


And talking of remembering those days of yore... For those who were
there, do you remember how Stephen Turner discovered 'www.googlism.com',
way back in 2002? And how /\ndrew tried my name on it, and saw that I
was described by a rather boring 'Yanick Champoux is currently m'? And
how he decided to take matters in his own hands and, ahhh..., spiffy up
things?

Well, to this very day, social network crawlers all over the Net are
prone to list me as a professor of psycho-sexual research at a great
European University.

Perl Golf... Yes, you may leave the green. But the green, it stays
forever with you. :-)


Joy,
`/anick

2009-05-10T17:15:37Z
Re: New series of articles on Code Golf by Jasper

From: Jasper Thanks for wasting my Sunday! And it's sunny! Son of a ...
--
Jasper

2009-05-10T01:37:48Z
New series of articles on Code Golf by Andrew Savige <p>From: Andrew Savige <br/>I&#39;ve finally completed a series of four articles on code golf, entitled<br/>&quot;The golf course looks great, my swing feels good, I like my chances&quot;:<br/><br/>&nbsp;* http://www.perlmonks.org/?node_id=759963&nbsp; (Part I)<br/>&nbsp;* http://www.perlmonks.org/?node_id=761053&nbsp; (Part II)<br/>&nbsp;* http://www.perlmonks.org/?node_id=762180&nbsp; (Part III)<br/>&nbsp;* http://www.perlmonks.org/?node_id=763105&nbsp; (Part IV)<br/><br/>Spoiler alert: these articles contain solutions from the codegolf<br/>Roman to Decimal game.<br/><br/>For nostalgia buffs, Eugene, Ton, Mtv, ... even `/anick all get<br/>a mention. :-)<br/><br/>Enjoy<br/>/-\<br/><br/><br/><br/><br/></p> 2009-05-10T00:52:48Z Re: In these times of economic crisis... by robert wilson

From: robert wilson 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 this together:
>
> perl -ne '$c[m/[mackrel]/]++;}print($c[1]/$.,$/);{' < sowpods
>
> However, there were complaints that it had too many dollar signs.
>
> What's the shortest equivalent script which uses no dollar signs at all?
>
> Phil
perl -le 'print+(grep{/[mackrel]/}@w=<>)/@w' < sowpods
?

now, if you actually want the answer to the question "what ratio of
words in the SOWPODS wordlist share _no_ letters in common with the word
mackerel?", you'd need to add a "!", like this:
perl -le 'print+(grep{!/[mackrel]/}@w=<>)/@w' < sowpods

2009-04-27T04:22:04Z
Re: In these times of economic crisis... by Jasper

From: Jasper 2009/4/26 Phil Carmody <thefatphil@yahoo.co.uk>:
>
> --- On Sun, 4/26/09, robert wilson <hotaru@safe-mail.net> 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 this together:
>> >
>> > perl -ne '$c[m/[mackrel]/]++;}print($c[1]/$.,$/);{' < sowpods
>> >
>> > However, there were complaints that it had too many dollar signs.
>> >
>> > What's the shortest equivalent script which uses no dollar signs at all?
>> >
>
>> perl -le 'print+(grep{/[mackrel]/}@w=<>)/@w' < sowpods
>
> Wow!!!
>
> It's obvious in retrospect. It's clear my original was horrifically wasteful, and can at least be shortened to this at the cost of one dollar:
> perl -le 'print+(grep{/[mackrel]/}<>)/$.' < sowpods

Shorter, with still one dollar. (actually, only shorter because you
have grep{} instead of grep with a comma, so the same)

perl -alp0e '$_=(grep/[mackrel]/,@F)/@F' < sowpods

Without the dollar, it's a bit longer, of course.

perl -aln0e 'print+(grep/[mackrel]/,@F)/@F' < sowpods

But that is the best I can do..
--
Jasper

(I'll send the tested one to the list, Phil)

2009-04-27T02:36:07Z
Re: In these times of economic crisis... by Phil Carmody

From: Phil Carmody
--- On Sun, 4/26/09, robert wilson <hotaru@safe-mail.net> 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 this together:
> >
> > perl -ne '$c[m/[mackrel]/]++;}print($c[1]/$.,$/);{' < sowpods
> >
> > However, there were complaints that it had too many dollar signs.
> >
> > What's the shortest equivalent script which uses no dollar signs at all?
> >

> perl -le 'print+(grep{/[mackrel]/}@w=<>)/@w' < sowpods

Wow!!!

It's obvious in retrospect. It's clear my original was horrifically wasteful, and can at least be shortened to this at the cost of one dollar:
perl -le 'print+(grep{/[mackrel]/}<>)/$.' < sowpods

Phil



2009-04-26T04:08:27Z
In these times of economic crisis... by Phil Carmody

From: 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 too many dollar signs.

What's the shortest equivalent script which uses no dollar signs at all?

Phil
--
() ASCII ribbon campaign () Hopeless ribbon campaign
/\ against HTML mail /\ against gratuitous bloodshed

[stolen with permission from Daniel B. Cristofani]



2009-04-26T01:19:00Z
scrabble word scorer by Jasper

From: Jasper Hi, y'all,

Can anyone beat 55 on this? I don't know if we ever did it as a
challenge. Should I search for it in the book?

--
Jasper

2008-06-17T03:44:15Z
Re: 答复: A challenge to explain the strange results (under linux) by Daniel Tiefnig

From: Daniel Tiefnig Zhu Shanshan wrote:
> As you said, when I substituted "s/\r\n$//" with "chomp", it did
> work. After looking up the explanation of "chomp" in perldoc, I found
> "chomp", which I always used to remove the newline previous, removes
> any trailing string that corresponds to the current value of "$/".

Hej,

JFTR, you may also want to have a look at "perldoc perlport". The first
issue discussed is "Newlines".

lg,
daniel

2008-06-12T09:56:56Z
答复: A challenge to explain the strange results (under linux) by Zhu Shanshan

From: Zhu Shanshan Thanks.
As you said, when I substituted "s/\r\n$//" with "chomp", it did work. After
looking up the explanation of "chomp" in perldoc, I found "chomp", which I
always used to remove the newline previous, removes any trailing string that
corresponds to the current value of "$/". And this time, it removed "\n" for
me. I'm really puzzled by this phenomena, because I always work with
"chomp". I guessed the problem came from the new SFTP software used
recently. Then I compared it with WinSCP using the same script. Bingo!
WinSCP has deleted "\r" for me and that's why I could luckily work,
previous.

Anyway, thank you again!


-----邮件原件-----
发件人: Ronald J Kimball [mailto:rjk-perl-golf@tamias.net]
发送时间: 2008年6月12日 12:28
收件人: Zhu Shanshan
抄送: Perl Golf
主题: Re: A challenge to explain the strange results (under linux)

I would bet that your color.txt file has Windows line endings on all
platforms. If you do this:

perl test.pl color.txt | less

you may find that you're getting output after all.


Make sure color.txt has Unix line endings on the Linux machines. Here's
one way to fix it:

perl -pi -e 'tr/\r//d' color.txt

Ronald


2008-06-11T22:30:31Z
Re: A challenge to explain the strange results (under linux) by Ronald J Kimball

From: Ronald J Kimball I would bet that your color.txt file has Windows line endings on all
platforms. If you do this:

perl test.pl color.txt | less

you may find that you're getting output after all.


Make sure color.txt has Unix line endings on the Linux machines. Here's
one way to fix it:

perl -pi -e 'tr/\r//d' color.txt

Ronald

2008-06-11T21:28:28Z
A challenge to explain the strange results (under linux) by Zhu Shanshan

From: Zhu Shanshan I used perl "v5.8.5 built for i386-linux-thread-multi".



My data:

##################### File:color.txt

chartreuse

deeppink

goldenrod

lightblue

dodgerblue

darkgoldenrod



My scripts:

##################### File: test.pl

use strict;

use warnings;

open IN,"color.txt" or die;

while (<IN>){

chomp;

print "$_";

}

close IN;



Results under linux platform(Nothing):

"Linux compome 2.6.12-1.1381_FC3smp #1 SMP Fri Oct 21 04:03:26 EDT 2005 i686
i686 i386 GNU/Linux" RedHat

"Linux biome 2.6.9-55.ELsmp #1 SMP Fri Apr 20 16:36:54 EDT 2007 x86_64
x86_64 x86_64 GNU/Linux" RedHat

"Linux hanlab 2.6.16.46-0.12-smp #1 SMP Thu May 17 14:00:09 UTC 2007 i686
i686 i386 GNU/Linux" OpenSUSE

##################### command: perl test.pl





Results under Microsoft Windows XP (in my expectation):

##################### command: d:\soft\bin\perl.exe test.pl

Chartreusedeeppinkgoldenrodlightbluedodgerbluedarkgoldenrod





It's not really a Perl challenge. But can anyone give me some help or
suggestions?

Thanks in advance



Shanshan Zhu


2008-06-11T21:00:16Z
Re: google's challenges by Jasper

From: Jasper 2008/5/30 Randal L. Schwartz <merlyn@stonehenge.com>:
>>>>>> "Jasper" == Jasper <jaspermccrea@gmail.com> writes:
>
> Jasper> Well, that was a big assumption, then.
>
> Keep in mind, "obvious" to you is very unlikely "obvious" to everyone else,
> since we all run in different circles.

I only found out about it because the guy next to me was doing them.
They do seem to be somewhat under the radar.

The third one opened yesterday. It wasn't really worthwhile writing a
program to solve it.

The robots one is still the only one I'd consider golfable. If one
allows the answers to be in non-integer format, the answer can be
pretty small - I have it around 48 with command line arguments. About
70 with the integer format required by google, and that's using
Math::BigInt.

Have a nice weekend..
--
Jasper

2008-05-30T02:07:12Z
Re: google's challenges by merlyn

From: merlyn >>>>> "Jasper" == Jasper <jaspermccrea@gmail.com> writes:

Jasper> Well, that was a big assumption, then.

Keep in mind, "obvious" to you is very unlikely "obvious" to everyone else,
since we all run in different circles.

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion

2008-05-29T18:02:43Z
Re: google's challenges by Bram

From: Bram On Tue, 27 May 2008 13:27:54 +0200, Jasper <jaspermccrea@gmail.com> wrote:

> Has anyone been golfing the google challenges?

What challenges?

>
> I've got the robot one to around 74 characters (not including the 'use
> Math::BigInt' :))
>
> The other one didn't seem all that interesting in comparison..
>
> ~~~tumbleweed~~~

2008-05-27T06:54:07Z