Re: [spam?] YN golf

2008-03-31 Thread Josh Goldberg
Knocking a few chars off yours for perl -le 'print join$/,map{y/01/NY/;$_}map unpack(b5,chr),0..31' and shrunk a few more by removing the join and using sprintf: perl -le 'print map{y/10 /YN/;$_}map{sprintf%5b$/,$_}0..31' On Mon, Mar 31, 2008 at 3:50 PM, Uri Guttman [EMAIL PROTECTED] wrote:

Re: Naming the @{[]} operator

2006-07-11 Thread Josh Goldberg
Let's just call it a rubber baby buggy bumper, then at least noone can say it three times fast regardless of what goes inside. It could be abbreviated to R3B, as in The best way to deref that structure is to use an arr three bee. Taking that another step, it could be an R2D2 as well. At least

Re: Self-recognizing programs and regular expressions

2005-03-08 Thread Josh Goldberg
How does this look? ^.[\\\[\]{}18.]{18}.$ On Mar 7, 2005, at 1:57 PM, Jasvir Nagra wrote: The challenge then is to find a regular expression inequ or failing that, the regular expression that accepts the smallest set of strings including itself. The score of an entry is the size of the set of

Re: Self-recognizing programs and regular expressions

2005-03-07 Thread Josh Goldberg
but you can't replace one of the leading \'s in the regexp (at least in perl), so I counted 16. On Mar 7, 2005, at 4:49 PM, Jasvir Nagra wrote: I think its 255^2 + 8^17. The two . account for 255^2 and there are 8^17 strings of length 17 with an 8 character alphabet. On Mon, 2005-03-07 at 19:26

Re: unhead

2004-09-24 Thread Josh Goldberg
Here's a little oneliner to skip the first 5 lines of the file 'foo': perl -i5 -e '@_=STDIN;[EMAIL PROTECTED]' foo On Sep 24, 2004, at 7:17 AM, Jose Alves de Castro wrote: You're probably all familiar with the commands head and tail, which let you extract the first or the last N lines of input

Re: tough regex problem

2004-09-17 Thread Josh Goldberg
How about this? return grep(/./s, $$bufref =~ m#(.*?)(?:$sep|\z)#gs) if wantarray; Josh On Sep 16, 2004, at 11:05 PM, Uri Guttman wrote: in file::slurp i currently split the file into lines (or records based on $/) using this code: return split( m|(?=$sep)|, ${$buf_ref} ) if wantarray

Re: Y2K Again ??

2004-05-14 Thread Josh Goldberg
$Yr = ($FieldA =~ /^(\d{2}).*/ and $1 20 ? 19 : 20).$1; On May 14, 2004, at 8:25 AM, Rick Klement wrote: Brian Morgan wrote: Good evening everybody, I have been working on a small database project and have come across the need to move some data from table A to table B, the year format in table A

Re: limit the list

2002-11-20 Thread Josh Goldberg
On Wed, 20 Nov 2002 [EMAIL PROTECTED] wrote: join ', ', grep{ ($b.=$_) !~ /.{91}/ || ?.? ($_ = 'etc.') } @names that didn't work in my test, but it gave me an idea with map. I know, I used goto, but when I try to break from the BLOCK it says i'm not really in a block inside map, even when I

Re: Google

2002-10-27 Thread Josh Goldberg
that's not fun with perl...

Re: shortest test for truth false assignment

2002-05-22 Thread Josh Goldberg
how about do_something($a=0) if $a; On Wed, 22 May 2002, Scott Wiersdorf wrote: My shortest try is this (10 characters w/o whitespace): if( $a%2 .. $a-- ) { do_something(); ... }

Re: shortest test for truth false assignment

2002-05-22 Thread Josh Goldberg
$a ; if ($a=~tr/.[^0]+/0/cs) { do_something(); } print $a\n; } sub do_something { print - ; } output: 1 - 0 0 0 foo - 0 0 0 On Wed, 22 May 2002, Yanick wrote: On Wed, May 22, 2002 at 10:06:39PM -0400, Josh Goldberg wrote: I came up with another one. This also works for values

Re: shortest test for truth false assignment

2002-05-22 Thread Josh Goldberg
ahhh, I get it now, thanks. On Wed, 22 May 2002, Ronald J Kimball wrote: On Wed, May 22, 2002 at 09:54:52PM -0400, Yanick wrote: On Wed, May 22, 2002 at 10:06:39PM -0400, Josh Goldberg wrote: I came up with another one. This also works for values of true other than 1

Re: shortest test for truth false assignment

2002-05-22 Thread Josh Goldberg
so then if($a=~tr/0/0/c) {do_something();} should work for any value of true, right? On Wed, 22 May 2002, Ronald J Kimball wrote: On Wed, May 22, 2002 at 09:54:52PM -0400, Yanick wrote: On Wed, May 22, 2002 at 10:06:39PM -0400, Josh Goldberg wrote: I came up with another one

RE: shortest test for truth false assignment

2002-05-22 Thread Josh Goldberg
if($a){do_something($a=0)} that's one stroke shorter On Thu, 23 May 2002 [EMAIL PROTECTED] wrote: I don't believe that you'll be able to shorten: if($a){$a=0;do_something()} any further unless you're able to use the flip-flop instead of $a: if($|--){do_something()} All suggestions so

Re: isNumber( ) ??

2001-10-18 Thread Josh Goldberg
On Thu, 18 Oct 2001, Selector, Lev Y wrote: Any recommendations? something like this perhaps? ns21# cat t.pl #!/usr/bin/perl sub isNumber { !/\d/ ? 0 : $_ == 0 ? 1 : $_ * 1 } for ( qw[ 0 abcdefg 1 -1.0 1.0e-10 10abc ] ) { print $_ - , isNumber($_), \n; } ns21# perl t.pl 0 -

RE: isNumber( ) ??

2001-10-18 Thread Josh Goldberg
Selector -Original Message- From: Josh Goldberg [mailto:[EMAIL PROTECTED]] Sent: Thursday, October 18, 2001 6:47 PM To: Selector, Lev Y Cc: '[EMAIL PROTECTED]' Subject: Re: isNumber( ) ?? On Thu, 18 Oct 2001, Selector, Lev Y wrote: Any recommendations? something like