my $sub = can($pkg, shift);
$sub && sub { $sub->($pkg, @_) };
}
}
--
Ilmari Karonen - http://www.sci.fi/~iltzu/
"Wow, this theory not only proves that Bill Gates is evil, but it proves
that our basic number system is flawed. THAT'S AMAZING!"
sure that it won't lose very much, as
it should settle into a random strategy if playing against an opponent
it can't successfully predict.
--
Ilmari Karonen - http://www.sci.fi/~iltzu/
"This is why Denver had a gigantic red-light district downtown in the early
days. A man may l
ated like
$H{cheese} = 'ducati';
$A[5] = \%H;
$S = \@A;
$name = \$S;
right?
I'm not exactly sure what, if anything, this is an argument for.
--
Ilmari Karonen - http://www.sci.fi/~iltzu/
"This must be a use of the word 'obvious' of which I was previously unaware."
-- Charles Martin in rec.arts.sf.science
not defined";
ok( defined $self->foo() );
}
Actually, it's not even ugly at all, really. True, the guts are
showing, but that's quite common in Perl. And it involves no new syntax
that would have to be looked up in the docs.
--
Ilmari Karonen - htt
d the "solution" seems obvious too. Export $TODO, so that it gets
aliased to every package where ok() is available.
--
Ilmari Karonen - http://www.sci.fi/~iltzu/
"You know why psych experimenters often use grad students as subjects,
right? It's because you have to feed
On Sun, 29 Jul 2001, Michael G Schwern wrote:
> On Sun, Jul 29, 2001 at 12:38:29PM +0300, Ilmari Karonen wrote:
> > And the "solution" seems obvious too. Export $TODO, so that it gets
> > aliased to every package where ok() is available.
>
> C would work, but
d just
simply write
return;
instead.
--
Ilmari Karonen - http://www.sci.fi/~iltzu/
"It's possible to write a Perl program that simulates a universal Turing
machine, so, yes, your point is both valid and correct."
-- Greg Bacon in comp.lang.perl.misc
On Mon, 6 Aug 2001, Marc wrote:
> On Mon, Aug 06, 2001 at 01:21:12PM +0300, Ilmari Karonen <[EMAIL PROTECTED]> wrote:
> > Shouldn't that rather be
> >
> > use constant NOTHING => ();
>
> yes, I noted that as well (but for some reason I forgot to re
On Mon, 6 Aug 2001, Andrew Pimlott wrote:
> On Tue, Aug 07, 2001 at 12:27:50AM +0300, Ilmari Karonen wrote:
> > () is an empty list, and the fact that an empty list
> > constant evaluates to undef in *scalar* context is an explicit feature
> > of constant.pm.
>
>
almost two orders of magnitude, and with input
number 5 the "1 while s/\s\z//" and "s/\s+\z//" performances are equal
to within a factor of 2.
I added the sexeger entry after I had already done most of the testing,
so all I can say about it is that it doesn't beat "1
On Mon, 13 Aug 2001, Ian Phillipps wrote:
> On Mon, 13 Aug 2001 at 12:13:23 +0300, Ilmari Karonen wrote:
>
> > * For any nontrivial text input, the "1 while s/\s\z//" approach is by
> >far the fastest.
>
> How about "chop while /\s\z/" ?
Fa
On Tue, 14 Aug 2001, Larry Shatzer wrote:
>
> You confused deparse, good job :o)
Although it's not really that hard, particularly for older versions of
B::Deparse. (The one in bleadperl deparses this just fine.)
--
Ilmari Karonen - http://www.sci.fi/~iltzu/
"That wasn
d above -- it probably gains very little over:
m{([a-z][a-z0-9+.-]+:[a-z0-9;/?:@&=+$,_.!~*'()%-]+)}ig;
and in fact this may be more robust when dealing with URLs containing
non-standard escape codes.
By the way, depending on the application, you probably want to add # to
the list of acceptable character
/
o->op_ppaddr = PL_ppaddr[OP_PREINC];
break;
case OP_POSTDEC:
o->op_type = OP_PREDEC; /* pre-decrement is faster */
o->op_ppaddr = PL_ppaddr[OP_PREDEC];
break;
--
# Ilmari Karonen -- http://www.sci.fi/~iltzu/
s''n4|9|21|3|n1\
ome flexibility
> in rules makes for more Japhs. Printing to either STDOUT
> or STDERR is allowed.
>- It doesn't print anything else.
So is this .sig a JAPH, then, or is it not? :-)
--
# Ilmari Karonen -- http://www.sci.fi/~iltzu/
s''n4|9|21|3|n1\2||2|(_-<2_|4_`
ist contains only one array. Yes, this is an
example of those funny unflattened lists like the one in "\(LIST)".)
The Nit Protection Society, however, is protesting this discussion...
--
Ilmari Karonen - http://www.sci.fi/~iltzu/
"Weetabix, mixed with milk and secretly sculpted on to t
package UNIVERSAL;sub print {map{s;::; ;g;print}@_=@_}AUTOLOAD{${(caller 0)[3]}}
Just->another->Perl->hacker->print(",\n");
--
Ilmari Karonen - http://www.sci.fi/~iltzu/
"TIMTOWTDI, but did you have to pick the ugliest way you could find?"
upposed to autoload.
This name, of course, then gets treated as the name of a package, and
another method is called on it, and so on...
So this code isn't "use strict" clean. It does, however, run without
any extra output even with warnings enabled.
--
Ilmari Karonen - http://www.s
On Sat, 20 Oct 2001, Bill Jones wrote:
> WWW-Authenticate: Negotiate
> WWW-Authenticate: NTLM
[snip]
> Client-Warning: Unsupported authentication scheme 'ntlm'
Okay, obvious question: Are authentication scheme names case-sensitive?
--
Ilmari Karonen - http://www.sci
long with any value the variable may hold, as well).
Looks a lot like Time::Stopwatch, except for the fancy output. I hope
you don't mind me stealing some ideas -- it's about time I got a new
version released, with new bells and whistles.
--
Ilmari Karonen - http://www.sci.fi/~iltzu/
&quo
sions 5.005_03 and 5.7.1:
perl -e 'print map chr, 0, 4 .. 255' | perl -c
That's a total of 253 out of 256 characters, which seems unbeatable.
No, I've no idea why that works. Explanations gladly accepted.
--
Ilmari Karonen - http://www.sci.fi/~
On Fri, 14 Dec 2001, Jeff 'japhy' Pinyan wrote:
> On Dec 14, Ilmari Karonen said:
> >On Thu, 13 Dec 2001, Jeff 'japhy' Pinyan wrote:
> >> On Dec 14, [EMAIL PROTECTED] said:
> >>
> >> >what is the longest piece of perl code $c whic
ke it yhorter and more viyible on my yyytem." ?
Besides, aren't single quotes special for s/// and y/// anyway? I think
what Keith _really_ meant was tr[\0\xff][ @] or equivalent.
BTW, I'd like to congratulate you for producing worst-case backtracking
behavior in my mental parser
ecurity, while keeping the code readable for yourself. Assuming, of
course, that the next guy after your job won't be a lisp programmer.)
--
Ilmari Karonen, "virtuaalisihteeri", Luonto-Liitto
it's a little extra work, but
it's no worse than what you have to do with s///. Turning an in-place
shuffle into copy-and-shuffle is easy, the other way is impossible.
--
Ilmari Karonen - http://www.sci.fi/~iltzu/
"Signal handlers are known to be broken in perl. Did you expect them to
somehow get unbroken when ITHREADS is enabled?"
-- Gurusamy Sarathy on the perl5-porters list
signments where the left and right hand sides overlap
are handled as special cases. It may be that this special handling has
been implemented in a suboptimal way. Or maybe it's just overhead from
the generic list assignment code as compared to scalar assignment.)
--
Ilmari Karonen - http
On Fri, 5 Apr 2002 [EMAIL PROTECTED] wrote:
> On Fri, Apr 05, 2002 at 12:17:27AM +0300, Ilmari Karonen wrote:
> > The point of taking a reference is that the Fisher-Yates algorithm is an
> > in-place shuffle. If your array happens to be a couple of megabytes in
> > size, yo
On Fri, 5 Apr 2002 [EMAIL PROTECTED] wrote:
> On Fri, Apr 05, 2002 at 06:30:17PM +0300, Ilmari Karonen wrote:
> >
> > Well, map does allow in-place modification. I seem to recall you taking
> > advantage of this feature before, and defending it quite vehemently
>
On Tue, 9 Apr 2002 [EMAIL PROTECTED] wrote:
> On Tue, Apr 09, 2002 at 01:49:01PM +0300, Ilmari Karonen wrote:
> > On Fri, 5 Apr 2002 [EMAIL PROTECTED] wrote:
> > >
> > > sub shuffle {
> > > for (my $i = @_; $i;) {
> > > m
hird step is dealing with the inevitable
backwards compatibility issues...
Want to submit a patch?
--
Ilmari Karonen - http://www.sci.fi/~iltzu/
"I once bought a 'wand of long blue line creation'. That's what it said
on the side and it worked, too." -- Jonathan L Cunningham in rasfc
*a = *|;
if ($a--) {
do_something();
}
Just make sure you don't select a different filehandle somewhere...
--
Ilmari Karonen - http://www.sci.fi/~iltzu/
"I admit, the original poster didn't say they wanted a solution that was
good. They just said they wanted it to be mu
picking up a new load of stuff to deliver.
And Perl isn't that slow. I'd be more worried about the 64MB limit...
--
Ilmari Karonen - http://www.sci.fi/~iltzu/
"We have argued that unskilled individuals suffer a dual burden: Not only
do they perform poorly, but they fail to realiz
to? And a test
client to observe?
Seriously, your protocol might well be secure, or at least secure enough
for the job it's doing. But we can't tell from that sample. (Or, if we
could, it definitely wouldn't be secure by any standards.)
--
Ilmari Karonen - http://www.sci.fi/~i
n extra
> element onto the string.
Yes it does work. Try it. Remember, $tail _cannot_ be undefined, since
it was returned by split(). @lines _can_ be empty, but that case works
as it should.
--
Ilmari Karonen
http://www.sci.fi/~iltzu/
accept a glob that way:
sub getaglob {*foo}
$foo = "pong\n";
for ${&getaglob} ("ping ") { print $foo }
print $foo;
works, printing "ping pong", while:
sub getaglob {*foo}
$foo = "pong\n";
{ local ${&getaglob} = "ping "; print $foo }
print $foo;
fails with "Can't localize through a reference"!
Weird.
--
Ilmari Karonen
ous from the code, is an 81-character string
listing the numbers in left-right, top-down order, with "_" for blanks.
The while loop mangles it into the proper format for the regexp (81
lines, each listing the allowed numbers for the corresponding cell) and
outputs the solution in the same format as the input.
--
Ilmari Karonen
Ilmari Karonen wrote:
Sudoku solvers are old hat, of course, but this one is a bit different:
it's a regexp. I suppose someone may have done this before, but if so,
I haven't seen it. It's grossly inefficient, of course, solving the
puzzle entirely by guesswork and backtrack
Robert C. Helling wrote:
On Thu, 20 Apr 2006, Ilmari Karonen wrote:
Ilmari Karonen wrote:
Incidentally, here's the hardcoded-givens version. It's indeed quite a
lot faster the generic version -- I've yet to find a puzzle that would
take more than 0.1 seconds to solve on my wor
Michael G Schwern wrote:
I have a solution!
DON'T USE $_ [1]
[1] Except in map and grep and the magic while(<>) where its localized.
Didn't this thread start from the fact that $_ is _not_ localized in the
magic while(<>) loop?
--
Ilmari Karonen
39 matches
Mail list logo