Re: Umlaut

2008-01-13 Thread Yanick Champoux

Georg Moritz wrote:

From the keyboard of Yanick Champoux [12.01.08,18:50]:
  

*dieresis* or *diæresis   *A diacritical mark (* ¨ *) optionally used in
English, oftentimes replaced by a hyphen. In English, the dieresis is used on
a second identical vowel to indicate a change in pronunciation of that vowel
or indicate it is pronounced in a separate syllable. It is sometimes referred
to as an « umlaut » when used with a single character or in a « diphthong. »
Examples: reëlecting, reëncoding, coöperation, coördination.



Actually the term umlaut in german denotes a shifted vowel. If you do
a transition from u - e biased towards i and stopping in the middle,
you have the ü, which can be written as diphtong also: ue. The e in
ue was often placed above the u in old german writing (where the e
was written like n, but with a sharp bend instead of a curve before the
last falling stroke). The four strokes necessary for that e were reduced
to two, and those to dots, hence the two points above the ü.

So, the umlaut is a shortened form of a diphtongy denoting a shifted vowel,
and *not* a diaeresis (ue is not a diphtong, but an umlaut ;-)
  


   Yup, I became aware of that yesterday when I shared my new golden 
nugget of trivia with my wife.  Being both German *and* a linguist, she 
promptly corrected my inaccuracies.  But she left out the part about the 
'e' mutating into the two little dots that we know and love nowadays, 
which I think is the coolest part of the whole story, so thanks for 
that! :-)



Joy,
`/anick


Re: regex of the month (decade?)

2008-01-13 Thread Yanick Champoux

Michael G Schwern wrote:

 Yanick Champoux wrote:
  
 *dieresis* or *diæresis  [..]
  
Really they just want to be more metal.  Soon it will be ¡KömpUsërV.DøøM!
  


   And to thing that, all those years, I laughed at Spinal Tap's claim 
to be avant-garde and visionary geniuses.  They were right.  All that 
time, they were right...


Joÿ,
`/anick





Re: The flaming X-wing secret operator

2007-11-30 Thread Yanick Champoux

shmem wrote:

in fact, shmem and Georg are the same guy, though 'Georg' just slipped ;-)


	One would think that the same sig and style and everything would have 
tipped me off.  But no... That was too suble for me still. :-P



Me likes. Lots.  I propose, as alternative names for those two tokens,
the fat bat (because it does look like a particularly rotund specimen of
that species, and in honor of the large value it yields) and thelaughing
joker (as in, just kidding, the rest of the line doesn't apply). :-)


Names OK. I'm glad you didn't come up with 'spacestation broken solar
panels' or such ;-D


	Oh, I considered it. But at the end, I thought that the other 
suggestions were rolling off the tongue a wee bit better. ;-)



Joy,
`/anick


Re: The flaming X-wing secret operator

2007-11-29 Thread Yanick Champoux

shmem wrote:

To brighten up your day - here's the winged moon, which isn't an
operator, but a constant:

[EMAIL PROTECTED]


Georg added:

Similar to the winged moon - an operator (token?) which scares
the hell out of the remainder of a list:

[EMAIL PROTECTED]



	Me likes. Lots.  I propose, as alternative names for those two tokens, 
the fat bat (because it does look like a particularly rotund specimen 
of that species, and in honor of the large value it yields) and 
thelaughing joker (as in, just kidding, the rest of the line doesn't 
apply). :-)


Joy,
`/anick


Fwd: first release of PerlWar

2005-11-01 Thread Yanick Champoux

 For the amusement of all camels and llamas present, here's a code-review of 
Perlwar done by Uri. For the record, he sent it my way barely a few hours 
after the initial release, which speaks volumes about the man's alacrity, and 
my weakness for procrastination. 

Joy,
`/anick


--  Forwarded Message  --

off list but you can forward this to fwp if you want

amusing. i browsed the code and it doesn't look too bad. i especially
analyzed the code of run_slot as it seems to be the heart of the
program. here are is some code review of it:

sub runSlot
{
   my ( $self, $slotId ) = @_;

 return unless $self-{theArray}[ $slotId ];

you have many common subexpressions (hash accesses) that slow things
down and clutter up the code. use variables to store lower level stuff
that you will need again later.

 my $theArray = $self-{theArray} ;
 my $curr_slot = $theArray-[ $slotId ];
 return unless $curr_slot ;

you don't need the %slot hash because you have a ref to it.


 my %slot = %{$self-{theArray}[ $slotId ]};
 return if $slot{freshly_copied} or not $slot{code};

 return if $curr_slot-{freshly_copied} or ! $curr_slot-{code};

a good rule of thumb is to use !, , || in expressions and not, and, or
where you do flow control (as in open or die).


 $self-log( cell $slotId: agent owned by $slot{owner} );

 my @Array = map $_-{code}, @{$self-{theArray}}[
 $slotId..(@{$self-{theArray}}-1), 0..($slotId-1) ];

you do that big array slice before you do the following test. in the
test you access $Array[0] but tha could also be theArray[$slot_id]{code}
or just even $curr_slot-{code}. then you can test first and only copy
the array when you know the slot has legal code

 # exceed permited size?
   if( length  $self-{conf}{snippetMaxLength} )

that takes length of $_ and not of the code.

   {
 $self-log( \tagent crashed: is .length($Array[0]). chars, exceeds
 max permitted size $self-{conf}{snippetMaxSize} ); $self-{theArray}[
 $slotId ] = {};
 return;
   }

your indent style is not the most common one which is to put { on the
end of lines of code and to indent the code by one level. this is harder
to read in mnay people's opinion. for more on this and coding styles,
get damian conway's new book, perl best practices.
the above could become:

 my $code_len = length( $curr_slot-{code} ) ;
 my $max_snippet = $self-{conf}{snippetMaxLength} ;
 if ( $code_len  $max_snippet ) {
  $self-log( LOG ) ;
\tagent crashed: is $code_len. chars, exceeds max permitted size
 $max_snippet LOG
  $theArray-[ $slotId ] = {};
  return ;
 }

   $self-log( \texecuting.. );

   my( $result, $error );
   ( $result, $error, @Array ) = $self-execute( @Array );

you can merge those like this:

   ( my( $result, $error ), @Array ) = $self-execute( @Array );

some may not like that. i don't mind as i like to declare when things
are first used if possible.

 $self-{theArray}[$slotId]{code} = $Array[0];

 $curr_slot-{code} = $Array[0];

again, you check an error that would wipe stuff out after you did useful
work. do this check just after the call to execute.

 if( $error ) {
 $self-log( \tagent crashed: $error );
 $self-{theArray}[$slotId] = {};
 return;
   }

***
   ( my( $result, $error ), @Array ) = $self-execute( @Array );

 if ( $error ) {

  $self-log( \tagent crashed: $error );
  $theArray-[$slotId] = {};
  return;
 }


   my $output = $result;
   $output = substr( $output, 0, 24 )... if length $output  25;
   $output =~ s#\n#\\n#g;

$self-log( \tagent returned: $output );


i notice plenty of redundant code in the next sections. i factored out
the 3 simpler return op codes and used a dispatch table to handle their
unique logic after i do the common logic

declare this table outside a sub as it is static

my %op_to_code = (

 '!'  = \nuke_operation,
 '^'  = \p0wn_operation,
 '~'  = \alter_operation,
) ;

then in the code do a single regex, the common code and dispatch on the
opcode

if( $result =~ /^([!^~])(-?\d*)$/ ) {

by the way, is '!-' (or any other op) allowed? you don't handle that
special case of - and no digits. this regex will disallow just -:

if( $result =~ /^([!^~])(-?\d+)?$/ ) {

 my $abs_pos = $self-relative_to_absolute_position( $slotId, $2 || 0 );
 return if $abs_pos == -1;

 my $slot = $theArray-[ $abs_pos ] ;
 unless ( $slot ) {

 $self-log( \tno agent found at cell $abs_pos );
  return ;
 }

 my $op_code_ref = $op_to_code{ $1 } ;

 $self-$op_code_ref( $theArray, $abs_pos, $slot ) ;
 return ;
}

if( $result =~ /^(-?\d*):(-?\d*)$/ ) {  # 212:213

  $self-copy_operation( $theArray, $1, $2 ) ;
  return ;
}

 $self-log( \tno-op );
}

note that that also removed all the elsif's which are nasty. when you
see a series of them, think dispatch table or some other way to do it.


sub nuke_operation {

 my( $self, $theArray, $abs_pos, $slot ) = @_ ;

$theArray-[ $abs_pos ] = { };
$self-log( \tagent in cell $abs_pos destroyed 

[ANNOUNCE] first release of PerlWar (and request for beta testers)

2005-10-17 Thread Yanick Champoux

After way too long in the making, I am proud to announce that a first beta of 
Perlwar is finally available to the public.

 Glad to hear that. But what is PerlWar?

PerlWar is loosely inspired by the classic Corewar game. In this game, players 
pit snippets of Perl code (called 'agents') against each other in order to 
gain control of the vicious virtual battlefield known as the Array. The final 
result is a Matrix-themed game mixing the cunning strategy of chess with the 
mad h4x0r skills of hardcore Perl scripting. Or so this author hopes.

 Sounds intringuing. Can you give us details?

Gladly. The rules of the games are available at 
http://babyl.dyndns.org/perlwar/wiki/PerlWarRules

 My interest's piqued. Is there any ongoing games I can peek at / join?

An alpha-testing game is available at http://babyl.dyndns.org/pw/beta/. If 
this announcement generate some interest and beta testers boldly volunteer, I 
plan to have a beta game running by the end of this week.

 Just for the giggles, can we look at the game engine's code?

The module should hit a CPAN near you anytime soon. Be warned, though, that 
this is release 0.01 of the module, and that the code ain't too pretty yet. 
So gaze at it at your own eyeballs' risk. 


Joy,
`/anick


Re: [ANNOUNCE] first release of PerlWar (and request for beta testers)

2005-10-17 Thread Yanick Champoux

 Well, I'll be darned. Some people actually volunteered. :-)

 So far, I have 7 volunteers to play in the first beta game, which should 
already be enough to have an unhealthy amount of fun (although it's not too 
late to jump on the bandwagon). If everything goes well, the game should kick 
off tomorrow at 22:00, EST time, at http://babyl.dyndns.org/pw/beta. 

 Also, in order not to spam the perl.org lists more than it is necessary, I've 
created [EMAIL PROTECTED] for game-related discussions. Feel free to 
subscribe if you want to lurk ([EMAIL PROTECTED]). In all 
cases, I'll post a post-mortem once the game will be over. 

 And now, if you excuse me, I have a war to start. 

Joy,
`/anick

PS: btw, abject apologies for the double posting of yesterday... That'll teach 
me to repost something after resubscribing to the list without thinking that 
the first post must still be sitting in the moderator's queue *hang head low 
and redden a wee bit*


[ANNOUNCE] first release of PerlWar (and request for beta testers)

2005-10-16 Thread Yanick Champoux

After way too long in the making, I am proud to announce that a first beta of 
Perlwar is finally available to the public.

 Glad to hear that. But what is PerlWar?

PerlWar is loosely inspired by the classic Corewar game. In this game, players 
pit snippets of Perl code (called 'agents') against each other in order to 
gain control of the vicious virtual battlefield known as the Array. The final 
result is a Matrix-themed game mixing the cunning strategy of chess with the 
mad h4x0r skills of hardcore Perl scripting. Or so this author hopes.

 Sounds intringuing. Can you give us details?

Gladly. The rules of the games are available at 
http://babyl.dyndns.org/perlwar/wiki/PerlWarRules

 My interest's piqued. Is there any ongoing games I can peek at / join?

An alpha-testing game is available at http://babyl.dyndns.org/pw/beta/. If 
this announcement generate some interest and beta testers boldly volunteer, I 
plan to have a beta game running by the end of this week.

 Just for the giggles, can we look at the game engine's code?

The module should hit a CPAN near you anytime soon. Be warned, though, that 
this is release 0.01 of the module, and that the code ain't too pretty yet. 
So gaze at it at your own eyeballs' risk. 


Joy,
`/anick


Re: Secret operators

2005-02-04 Thread Yanick Champoux
Andrew Savige wrote:
   @{[]}   join $, ...
   

   My better half proposes to call this one the papoose operator.
Joy,
`/anick