Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Perl golf article at Perl Monks

1 view
Skip to first unread message

Andrew Savige

unread,
Mar 8, 2005, 6:07:53 AM3/8/05
to go...@perl.org
A new article on Perl Golf has appeared at PM:

http://www.perlmonks.org/?node_id=437032

Someone has enquired about the true identity of Ton Hospel
and I didn't really know how to answer.

/-\


Find local movie times and trailers on Yahoo! Movies.
http://au.movies.yahoo.com

Jasper

unread,
Mar 8, 2005, 6:17:43 AM3/8/05
to go...@perl.org
On Tue, 8 Mar 2005 22:07:53 +1100 (EST), Andrew Savige
<ajsa...@yahoo.com.au> wrote:
> A new article on Perl Golf has appeared at PM:
>
> http://www.perlmonks.org/?node_id=437032
>
> Someone has enquired about the true identity of Ton Hospel
> and I didn't really know how to answer.

Nice. Perhaps it'll prompt a new compo soon :)


--
Jasper

Ala Qumsieh

unread,
Mar 10, 2005, 12:49:08 PM3/10/05
to Jasper, go...@perl.org

--- Jasper <jasper...@gmail.com> wrote:

> Nice. Perhaps it'll prompt a new compo soon :)

Ahhh .. how I long for the good old days.
Speaking of that, there was a post yesterday on
comp.lang.perl.misc asking about a one-liner to
reverse the lines in a file in-place. So the input
file itself must be modified and no other files must
be created.

I came up with this:
perl -aF"\n" -lp0 -i -e '$_=join$\,reverse@F' in.file

But then, I remembered Eugene's (in)famous solution to
reverse sort, but couldn't get it to work:

perl -pi -e '$x=$_.$x}{$_=$x' in.file

This prints to screen, not back to the file.
Any takers?

--Ala


__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

Vidul Petrov

unread,
Mar 10, 2005, 2:06:00 PM3/10/05
to Eirik Berg Hanssen, ala_q...@yahoo.com, jasper...@gmail.com, go...@perl.org
Traditional way:

perl -i -ne 'unshift@_,$_;eof&&print@_' in.file

>-------- Оригинално писмо --------
>От: Eirik Berg Hanssen <Eirik-Ber...@allverden.no>
>Относно: Re: Perl golf article at Perl Monks
>До: Ala Qumsieh <ala_q...@yahoo.com>
>Изпратено на: Четвъвтък, 2005, Март 10 20:40:18 EET
>----------------------------------


>
>Ala Qumsieh <ala_q...@yahoo.com> writes:
>
>> I came up with this:
>> perl -aF"\n" -lp0 -i -e '$_=join$\,reverse@F' in.file
>>
>> But then, I remembered Eugene's (in)famous solution to
>> reverse sort, but couldn't get it to work:
>>
>> perl -pi -e '$x=$_.$x}{$_=$x' in.file
>>
>> This prints to screen, not back to the file.
>> Any takers?
>

> (It prints to screen because the special output file is no longer
>select()ed. But you all knew that.)
>
> My take:
>
>perl -ni -e 'eof&&print;$\=$_.$\' in.file
>
>
>Eirik
>--
>GUIs normally make it simple to accomplish simple actions and
>impossible to accomplish complex actions.
> -- Doug Gwyn (in comp.unix.wizards on June 22, 1991)
>

-----------------------------------------------------------------
http://gbg.bg/search - Изпробвайте още сега най-добрата българска търсачка!

Yanick Champoux

unread,
Mar 10, 2005, 11:54:37 PM3/10/05
to go...@perl.org
Ala Qumsieh wrote:

>--- Jasper <jasper...@gmail.com> wrote:
>
>
>>Nice. Perhaps it'll prompt a new compo soon :)
>>
>>
>
>Ahhh .. how I long for the good old days.
>
>

So do I, so do I. In fact, as nostalgia settles in, I've found
myself toying more and more these days with a type of competition that
would both encompass the Hermetic arts of golfing and allow for vicious
interaction between players. What I came up with is a Perl variation on
the old venerable Corewar game that, I think, might be great fun. For
some demented definition of fun, it goes without saying.

In all cases, I have attached to this post a draft of the rules of
the game. I hope to have the game engine (plus a web / email interface)
ready by mid-April. So if anyone's curiosity is piqued by the thing, I
might try to organize a public tournament then...


Joy,
`/anick
PS: Wonderful article, /-\ !

perlwar.rules

Stephen Turner

unread,
Mar 11, 2005, 4:46:26 AM3/11/05
to Perl golf mailing list
On Thu, 10 Mar 2005, Yanick Champoux wrote:
>
> So do I, so do I. In fact, as nostalgia settles in, I've found myself
> toying more and more these days with a type of competition that would both
> encompass the Hermetic arts of golfing and allow for vicious interaction
> between players. What I came up with is a Perl variation on the old venerable
> Corewar game that, I think, might be great fun. For some demented definition
> of fun, it goes without saying.
>
> In all cases, I have attached to this post a draft of the rules of the
> game. I hope to have the game engine (plus a web / email interface) ready by
> mid-April. So if anyone's curiosity is piqued by the thing, I might try to
> organize a public tournament then...
>

Yes, we all have to play this game! But have you considered a variant in
which the maximum snippet length decreases as the game goes on? This would
make the game progressively harder as you get towards the end.

--
Stephen Turner, Cambridge, UK http://homepage.ntlworld.com/adelie/stephen/
"Low Priced Cambridge Clare College. Big selection at eBay UK!"
(Ad after Google search for Clare College Cambridge)

0 new messages