Re: simple rpn desktop calculator

2003-08-14 Thread Simon Cozens
Bennett Todd: Jonathan Paton mentioned Math::RPN; I hadn't heard about that one. My favourite little handy rpn desktop calculator just got a whole lot simpler: [16 lines of code] For additional fun, let me contrast this with a chapter summary for a proposed book on Perl Patterns. (Not Phil

Re: [quickie] Rounding up to next multiple

2003-08-14 Thread Simon Cozens
Leon Brocard: *cough* Data::Page *cough* Maybe you mean Data::Pageset? :) -- So remember when you're feeling very small and insecure How amazingly unlikely is your birth, And pray that there's intelligent life somewhere up in space, 'Cause there's bugger-all down here on Earth. (Monty Python)

Re: Hidden state? Invisible closures?

2003-05-27 Thread Simon Cozens
Matthias Bauer: It seems as if the array created to hold the returned AV of ''reverse 0..5`` is somehow re--used in later invocations of blah(). That's precisely what's going on. Bug or feature or programming error? I'd say it was undefined behaviour. -- fimmtiu Sucks really Forth. Ugh.

Re: Metaprogramming

2002-12-15 Thread Simon Cozens
Randal L. Schwartz: That's what I expect code2text to do. Dump the coderef so that I can restore it. And for closures, it must dump the state of the closure variables. There isn't a current state. What would you like { my $start = halting_problem_to_detect_at_compile_time();

Re: Metaprogramming

2002-12-13 Thread Simon Cozens
Steffen Mueller: So any code that uses closures is pathological? Hmm, let's see: perl -MO=Deparse -e 'my $x; {my $foo = Hello!; $x=sub{print $foo};}; $x-()' my $x; { my $foo = 'Hello!'; $x = sub { print $foo; } ; } $x(); Nope, seems not. -- Citizen_X I detest

Re: Metaprogramming

2002-12-13 Thread Simon Cozens
Steffen Mueller: Okay, I read up on it, but: You are expected to have read the Perl and XS sources to this module before attempting to do anything with it. I cannot read XS :) Yeah, it was just a long-term plot to sell more books. -- IBM: It may be slow, but it's hard to use.

Re: want to hide perl scripts

2002-10-31 Thread Simon Cozens
vakeel ahmad: is there any way to hide perl scripts. I keep mine in a locked filing cabinet, filed under Sund. Exps. -- FAILURE: When Your Best Just Isn't Good Enough http://www.despair.com

Re: want to hide perl scripts

2002-10-31 Thread Simon Cozens
Murali Karamchedu: Perl Source Filters provide some level of obscurity, look up: Combine with B::Deparse for hours of Fun With Stupid Programmers! -- IDIOCY: Never Underestimate The Power Of Stupid People In Large Groups

Re: ~9M lines of data

2002-10-14 Thread Simon Cozens
iudicium ferat: # CREATE TABLE if (/^CREATE\sTABLE\s\(/) { # End of segment if (/^\#\sDumpings\datas\for\stable\s\'/) { This is what the flip-flop operator is for. -- I want you to know that I create nice things like this because it pleases the Author of my story. If this

Re: a Perl expert (contractor) needed urgently

2002-06-13 Thread Simon Cozens
Shelley Gooch: Hi, Here is the job info: That's not fun with Perl! Where's your JAPH? (Are you sure you didn't mean this to go to [EMAIL PROTECTED] instead?) -- With the arrest of Dimitry Sklyarov it has become apparent that it is not safe for non US software engineers to visit the United

Re: perl5.6.1 oddity?

2002-06-13 Thread Simon Cozens
Stefan `Sec` Zehl: The shortest test case i found is: | ice:~echo a |perl5.6.1 -we 'print $1' | Use of uninitialized value in string at -e line 1. | ice:~echo a |perl5.6.1 -we 'print $1\n' | | ice:~echo a |perl5.6.1 -we 'print .$1\n' | Use of uninitialized value in concatenation (.) or

Re: reading lines backwards

2002-06-11 Thread Simon Cozens
Bruno Tavares: lines = FILE; Reading a huge file into memory at once considered harmful. -- Move 1 pdcawley [11k]: This is, of course, where it all started to go wrong.

Re: Reading Huge Files into Memory (was RE: reading lines backwards )

2002-06-11 Thread Simon Cozens
Michael G Schwern: AFAIK there is no easy way to force Perl to return memory to the system, nor This is because Perl calls free(3) (deep down) and that may not actually return memory to the system on the same basis that Perl doesn't always call free() when it has some memory free - that memory

Re: shortest test for truth false assignment

2002-05-22 Thread Simon Cozens
Scott Wiersdorf: if( $a%2 .. $a-- ) { I don't understand this. You see, if $a-- leaves $a as false, then: if ($a--) is the shortest way of solving the problem. And if not, then your code above won't work: % perl -le '$a=2;if( $a%2 .. $a-- ) {print Hi}; print $a' 2 (2 is, you will

Re: Golf and the Perl Review

2002-02-06 Thread Simon Cozens
Bart Lateur: One says yes, the other says no. So what's it gonna be?:-) http://www.snopes.com/language/acronyms/cabal.htm -- emacs: Terminal type emacs is not powerful enough to run Emacs.

Re: OK ...

2002-02-05 Thread Simon Cozens
;sub foad{die FOAD\n};$op[50]=\evl; sub evl{($a,$b)=get(2) ;eval join ,map {chr} @r[$a..$b]} RUN # **!! version 0, 09/05/2000 __END__ =head1 DESCRIPTION The **!! Programmer's Reference Guide =head1 PERPETRATOR Simon Cozens, [EMAIL PROTECTED] =head1 THE **!! LANGUAGE =head2

Re: RPN calculator

2002-01-21 Thread Simon Cozens
On Mon, Jan 21, 2002 at 03:43:38PM -0800, Peter Scott wrote: Seems that it can be extended to arbitrary operators without losing any conciseness: So, who's gonna go to the obvious next level and give us an ofuscated FORTH implementation, plus a decent JAPH in FORTH? -- I've looked at the

Re: ^=~

2002-01-20 Thread Simon Cozens
On Sun, Jan 20, 2002 at 03:40:20PM -0500, Yanick wrote: But I still don't understand what it brings more than a classic 'map', or why The Power That Is didn't just decided to do an overloading of =~ (so @a =~ /stuff/ would work) The fact that we have ^=~ is just a side-effect of the

Re: ^=~

2002-01-19 Thread Simon Cozens
On Sat, Jan 19, 2002 at 02:42:11PM +, Robin Houston wrote: Any thoughts? Sunbather. -- Though a program be but three lines long, someday it will have to be maintained. -- The Tao of Programming

Re: Possible improvements for the next golf apocalypse

2001-12-13 Thread Simon Cozens
On Thu, Dec 13, 2001 at 05:23:37PM +1100, [EMAIL PROTECTED] wrote: I think I should highlight what I think is a Perl bug that affects golf games. I'm pretty sure I wrote about that last week. :) -- For me, UNIX is a way of being. -Armando P. Stettner

Re: Possible improvements for the next golf apocalypse

2001-12-10 Thread Simon Cozens
On Mon, Dec 10, 2001 at 10:07:15AM -0600, Nicholson, Dale wrote: Santa is nothing more than a perversion added later. Or a shortened name for Saint Nicholas, a Saint of the Catholic church. The choice is yours. -- There seems no plan because it is all plan. -- C.S. Lewis

Re: middle line, redux

2001-12-03 Thread Simon Cozens
On Mon, Dec 03, 2001 at 08:54:06PM +0100, Philip Newton wrote: perl -p Hm? How does this print only the middle line of a file? Who said anything about only? Write a program that reads the lines from a file and outputs the middle line. -- Actually Perl *can* be a Bondage

Re: Fun with xterm window titles, or Yet Another golf challenge

2001-09-07 Thread Simon Cozens
On Fri, Sep 07, 2001 at 01:01:44AM -0500, Craig S. Cottingham wrote: Can anyone see a way the second script can be condensed You are allowed to assume that you're running bash If I could assume I was using zsh: prompt adam1 But then zsh makes most things easier. :) Simon

Re: Fun with xterm window titles, or Yet Another golf challenge

2001-09-07 Thread Simon Cozens
On Fri, Sep 07, 2001 at 08:32:52AM +0200, Newton, Philip wrote: export PROMPT_COMMAND=perl -e '@d=split/\//,qx(pwd);@d=(q(...),@d[-2,-1])if@d3; ^^^ chomp@d;\$\=q(/);print+qq(\e]0;@d\a)' ^ Still too repetitive. :)