[18466] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 634 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Apr 5 09:05:40 2001

Date: Thu, 5 Apr 2001 06:05:17 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <986475916-v10-i634@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Thu, 5 Apr 2001     Volume: 10 Number: 634

Today's topics:
    Re:  Re: Range operator behaves strangely demerphq@hotmail.com
    Re: array and hash presentation as text <bmb@ginger.libs.uga.edu>
        Does "return @list" do a copy? (Norman Gaywood)
    Re: Does "return @list" do a copy? (Anno Siegel)
    Re: Does "return @list" do a copy? <bmb@ginger.libs.uga.edu>
        FILES IN DIR's <Per-fredrik.Pollnow@epk.ericsson.se>
    Re: FILES IN DIR's <graham.wood@iona.com>
    Re: maximum value of a list (Logan Shaw)
    Re: maximum value of a list (Randal L. Schwartz)
    Re: maximum value of a list nobull@mail.com
    Re: maximum value of a list (Logan Shaw)
    Re: maximum value of a list (Randal L. Schwartz)
    Re: Newbies welcome (Logan Shaw)
    Re: Newbies welcome (Gwyn Judd)
    Re: Newbies welcome (Bernard El-Hagin)
    Re: Newbies welcome (Anno Siegel)
    Re: Newbies welcome (Gwyn Judd)
    Re: Newbies welcome (Logan Shaw)
    Re: Newbies welcome <camerond@mail.uca.edu>
    Re: Newbies welcome (Bernard El-Hagin)
    Re: Perl training courses in the UK? <paul.groves@oucs.ox.ac.uk>
    Re: Please Flame my Benchmark: open vs. cat (Abigail)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: 5 Apr 2001 10:45:20 GMT
From: demerphq@hotmail.com
Subject: Re:  Re: Range operator behaves strangely
Message-Id: <9ahic021eie@news1.newsguy.com>

nobull writes:
>        The auto-increment operator has a little extra builtin
>        magic to it.  

Ok, so I didn't read the spec on the autoincrement operators.  I only read the perlop documentation on the range operator and didnt follow up with the autoincrement.  Sorry

<SNIP>

>                                             and has a value
>        that is not the empty string and matches the pattern
>        `/^[a-zA-Z]*[0-9]*$/', the increment is done as a string,
>        preserving each character within its range, with carry:

All is now clear.

<SNIP>

> Can you please submit a perlbug report detailing where you found
> documentation that contradicts this.

Obviously not, and I suppose while stinging the sarcasm is deserved.  Thanks for pointing me to the relevent docs NoBull.

Much obliged.
demerphq


==================================
Posted via http://nodevice.com
Linux Programmer's Site


------------------------------

Date: Thu, 5 Apr 2001 08:12:20 -0400
From: Brad Baxter <bmb@ginger.libs.uga.edu>
Subject: Re: array and hash presentation as text
Message-Id: <Pine.A41.4.21.0104050806080.16576-100000@ginger.libs.uga.edu>

On Wed, 4 Apr 2001, Anas Nashif wrote:
>  If $[] defines a hash and [] defines an array, how can I parse such a text 
>  structure into one perl variable:
>  
>  $["key1":"value1","key2":[1,2,3,4]]
>  
>  or 
>  
>  [[[1,2],3,4,5],6,7,8]
>  
>  Any Idea?
>  
>  The result should be in case 1 a hash of values and arrays.
>  The second is an array of arrays....

Is there any reason that you can't simply represent the hash and array
text the same way that Perl does?

{"key1"=>"value1","key2"=>[1,2,3,4]}

[[[1,2],3,4,5],6,7,8] (oops, that is the same way :-)

#!/usr/local/bin/perl
use warnings;
use strict;
use Data::Dumper;

while(<DATA>){
  my $ref = eval;
  die $@ if $@;
  print Dumper( $ref );
}

__DATA__
{"key1"=>"value1","key2"=>[1,2,3,4]}
[[[1,2],3,4,5],6,7,8]


Brad (I'm not data)



------------------------------

Date: 5 Apr 2001 21:28:06 +1000
From: norm@turing.une.edu.au (Norman Gaywood)
Subject: Does "return @list" do a copy?
Message-Id: <9ahks6$epk$1@turing.une.edu.au>
Keywords: perl array return

I think this is a question about the internals of perl.

Suppose I have some code like this:

  my $big = 1000000;
  sub bigarray {
    my @ll;
    @ll[0..$big] = 1 x $big;
  }
  my @bl = bigarray;

From what I can tell, the array is built in biglist() and on return the
built array is copied to the new array (@bl). So briefly 2 copies of this
big array exist while the values are copied. A pretty expensive operation.

And before I get told, "Use references. Cheers.", I know I can
do this:

sub rbigarray {
my @ll;
  @ll[0..$big] = 1 x $big;
  \@ll;
}

But this means I have to remember to de-reference to get to my data.
In this modern day and age with memory handling all done for us, why is
this so?

So I guess my question is, would it not be better to avoid the copy of
arrays/lists on return from subroutines internally in perl? What is the
reason it is not.

BTW, the way I figured out the copy is probably happening is by running
a few variations on the above and looking at the memory used.

-- 
Norman Gaywood -- School of Mathematical and Computer Sciences
University of New England, Armidale, NSW 2351, Australia
norm@turing.une.edu.au     http://turing.une.edu.au/~norm
Phone: +61 2 6773 2412     Fax: +61 2 6773 3312


------------------------------

Date: 5 Apr 2001 12:12:53 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Does "return @list" do a copy?
Message-Id: <9ahng5$1c4$1@mamenchi.zrz.TU-Berlin.DE>
Keywords: perl array return

According to Norman Gaywood <norm@turing.une.edu.au>:
> I think this is a question about the internals of perl.
> 
> Suppose I have some code like this:
> 
>   my $big = 1000000;
>   sub bigarray {
>     my @ll;
>     @ll[0..$big] = 1 x $big;
>   }
>   my @bl = bigarray;
> 
> From what I can tell, the array is built in biglist() and on return the
> built array is copied to the new array (@bl). So briefly 2 copies of this
> big array exist while the values are copied. A pretty expensive operation.
> 
> And before I get told, "Use references. Cheers.", I know I can
> do this:
> 
> sub rbigarray {
> my @ll;
>   @ll[0..$big] = 1 x $big;
>   \@ll;
> }
> 
> But this means I have to remember to de-reference to get to my data.
> In this modern day and age with memory handling all done for us, why is
> this so?

Perl doesn't do any referencing or de-referencing for you. (Well,
there seems to be something fishy going on with filehandles, but
in general it doesn't.)  It's a design decision.  Lisp goes the
other way:  You work with references more than anything else, but
the language doesn't even have the concept of reference.  Both have
their ups and downs.
 
> So I guess my question is, would it not be better to avoid the copy of
> arrays/lists on return from subroutines internally in perl? What is the
> reason it is not.

The semantics would be different.  The caller would have access to the
original list elements.  This may not be a big deal when a routine
returns a lexical array, but when (say) a method returns a list from
its internal structures, the caller would be able to alter its content
in unforeseen ways.  And I don't like to think what would happen if
someone decided to return @_.

Anno


------------------------------

Date: Thu, 5 Apr 2001 08:36:59 -0400
From: Brad Baxter <bmb@ginger.libs.uga.edu>
Subject: Re: Does "return @list" do a copy?
Message-Id: <Pine.A41.4.21.0104050815150.16576-100000@ginger.libs.uga.edu>

On 5 Apr 2001, Norman Gaywood wrote:
> But this means I have to remember to de-reference to get to my data.
> In this modern day and age with memory handling all done for us, why is
> this so?

Remember?  You have to remember a lot to write a program.  I'm only being
slightly sarcastic--I'm actually puzzled.


> So I guess my question is, would it not be better to avoid the copy of
> arrays/lists on return from subroutines internally in perl? What is the
> reason it is not.

You're obviously aware that 'return' returns a list (or scalar or nada),
and not an array.  It sounds like you're suggesting that perl return a
reference (or alias) to the array without making it look like a reference
or alias.

What would you expect the following to do internally in that case:

     1  #!/usr/local/bin/perl
     2  use warnings;
     3  use strict;
     4
     5  my @a = ( 1, 2, 3, 4, 5 );
     6
     7  print a( 1,4 ), "\n";
     8
     9  sub a { return @a[ @_ ] }

Brad



------------------------------

Date: Thu, 5 Apr 2001 12:28:10 +0200
From: "Per- Fredrik Pollnow" <Per-fredrik.Pollnow@epk.ericsson.se>
Subject: FILES IN DIR's
Message-Id: <9ahgih$dgk$1@newstoo.ericsson.se>

Hi,

I need some help with my mini perl Script.. I'm trying to look for new files
in dir /usr/ and in the author dirs under the /usr/ dir,  etc [/usr/local/].
But I can't fig out how to do. can some one please help me.

This is my script:

#!/usr/bin/perl -w
use strict;
my ($dir, $file);
$dir = "/usr";
print "New files and dir's under /usr:\n";
opendir(USR, $dir) or die "Can't open $dir $!\n";
while ( defined ($file = readdir USR) ) {
 print "$file\n" if -M "$dir/$file" <= 1.0;
}
closedir(USR);

But I only see the files and dirs in /usr. I want to see all the files under
/usr... etc [/usr/local/bin or /usr/sbin]. ( if someone understands what I'm
talking about please send me an answer).





------------------------------

Date: Thu, 5 Apr 2001 11:35:10 +0100
From: "Graham Wood" <graham.wood@iona.com>
Subject: Re: FILES IN DIR's
Message-Id: <9ahhot$rp$1@spider.iona.com>


Per- Fredrik Pollnow <Per-fredrik.Pollnow@epk.ericsson.se> wrote in message
news:9ahgih$dgk$1@newstoo.ericsson.se...
> Hi,
>
> I need some help with my mini perl Script.. I'm trying to look for new
files
> in dir /usr/ and in the author dirs under the /usr/ dir,  etc
[/usr/local/].
> But I can't fig out how to do. can some one please help me.
>
> This is my script:
>
> #!/usr/bin/perl -w
> use strict;
> my ($dir, $file);
> $dir = "/usr";
> print "New files and dir's under /usr:\n";
> opendir(USR, $dir) or die "Can't open $dir $!\n";
> while ( defined ($file = readdir USR) ) {
>  print "$file\n" if -M "$dir/$file" <= 1.0;
> }
> closedir(USR);
>
> But I only see the files and dirs in /usr. I want to see all the files
under
> /usr... etc [/usr/local/bin or /usr/sbin]. ( if someone understands what
I'm
> talking about please send me an answer).

Use File::Find which is designed to recurse through all the subdirectories.

Graham Wood




------------------------------

Date: 5 Apr 2001 05:30:12 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: maximum value of a list
Message-Id: <9ahhfk$asa$1@boomer.cs.utexas.edu>

In article <n6elv7k6ud.fsf@xii5.it.jyu.fi>,  <tt@mit.jyu.fi> wrote:
>Is there some simple expression that returns the maximum
>value of a list?
>
>I find myself using sort for the purpose, and it
>seems kind of overkill, yet it is much easier to use
>than an explicit loop.
  :
  :
>but I dislike using sort, which is O(N log N) in time
>complexity, when a linear time should suffice. 

I don't think there is a more obvious way than what you've already
mentioned.

Personally, I think Perl needs a built-in list folding function, like
this:

	sub fold
	{
		my ($sub, @list) = @_;

		my $result = shift @list;
		$result = &$sub ($result, shift @list) while (@list > 0);

		return $result;
	}

Then, you can find the sum of a list like this:

	$sum = fold (sub {$_[0] + $_[1]}, qw{ 10 20 30 40 50 60 70 80 90 });

Or the maximum of a list like this:

	sub max
	{
		return ($_[0] > $_[1]) ? $_[0] : $_[1];
	}

	$max = fold (\&max, qw{ 7 43 8 9 4 6 6 3 77 43 4 3 4 5 3 });

And you can rewrite join() like this:

	sub my_join
	{
		my ($separator, @list) = @_;

		fold (sub { $_[0] . $separator . $_[1] }, @list);
	}

And so on and so on.

Actually, it would be best to allow fold to have an identity
value for whatever function as well, i.e. it'd be nice to have
a version of fold like the one above and one like this:

	sub ifold
	{
		my ($sub, $identity, @list) = @_;

		my $result = $identity;
		$result = &$sub ($result, shift @list) while (@list > 0);
	}

This has what sometimes (not always) works out as a better behavior
when the list is empty.  For instance, the ifold() version of
my_join():

	sub my_join
	{
		my ($separator, @list) = @_;

		ifold (sub { $_[0] . $separator . $_[1] }, "", @list);
	}

returns an empty string rather than undef when it's asked to join an
empty list.

And yes, in case anyone is wondering, I blatantly stole this idea from
Haskell.  Haskell actually has a few other cool list operators that I
think Perl could use, like maybe zip.

  - Logan
-- 
whose?  my  your   his  her   our   their   _its_
who's?  I'm you're he's she's we're they're _it's_


------------------------------

Date: 05 Apr 2001 04:09:12 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: maximum value of a list
Message-Id: <m1n19vob6v.fsf@halfdome.holdit.com>

>>>>> "Logan" == Logan Shaw <logan@cs.utexas.edu> writes:

Logan> Personally, I think Perl needs a built-in list folding function, like
Logan> this:

Logan> 	sub fold
Logan> 	{
Logan> 		my ($sub, @list) = @_;

Logan> 		my $result = shift @list;
Logan> 		$result = &$sub ($result, shift @list) while (@list > 0);

Logan> 		return $result;
Logan> 	}

Logan> Then, you can find the sum of a list like this:

Logan> 	$sum = fold (sub {$_[0] + $_[1]}, qw{ 10 20 30 40 50 60 70 80 90 });

Simple enough... and it's already written:

    use List::Util qw(reduce); # in the CPAN
    $sum = reduce { $a + $b } qw{ 10 20 30 40 50 60 70 80 90 };

Or even simpler, there's a sum function already defined there:

    use List::Util qw(sum);
    $sum = sum w{ 10 20 30 40 50 60 70 80 90 };

Logan> Or the maximum of a list like this:

Logan> 	sub max
Logan> 	{
Logan> 		return ($_[0] > $_[1]) ? $_[0] : $_[1];
Logan> 	}

Logan> 	$max = fold (\&max, qw{ 7 43 8 9 4 6 6 3 77 43 4 3 4 5 3 });

Yeah, that's easy...

    use List::Util qw(reduce);
    $max = reduce { $a > $b ? $a : $b } qw{ 7 43 8 9 4 6 6 3 77 43 4 3 4 5 3 };

or just

    use List::Util qw(max);
    $max = max qw{ 7 43 8 9 4 6 6 3 77 43 4 3 4 5 3 };

Logan> And you can rewrite join() like this:

Logan> 	sub my_join
Logan> 	{
Logan> 		my ($separator, @list) = @_;

Logan> 		fold (sub { $_[0] . $separator . $_[1] }, @list);
Logan> 	}

Logan> And so on and so on.

Logan> Actually, it would be best to allow fold to have an identity
Logan> value for whatever function as well, i.e. it'd be nice to have
Logan> a version of fold like the one above and one like this:

Identity is just the first element passed into the list!

Logan> And yes, in case anyone is wondering, I blatantly stole this idea from
Logan> Haskell.  Haskell actually has a few other cool list operators that I
Logan> think Perl could use, like maybe zip.

It pays to look into the CPAN from time to time.  List::Util has been
there for many moons.

use List::Util 'reduce'; print reduce {"$a $b"} reverse qw{hacker, Perl another Just}

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


------------------------------

Date: 05 Apr 2001 12:30:53 +0100
From: nobull@mail.com
Subject: Re: maximum value of a list
Message-Id: <u98zlfshw2.fsf@wcl-l.bham.ac.uk>

logan@cs.utexas.edu (Logan Shaw) writes:

> In article <n6elv7k6ud.fsf@xii5.it.jyu.fi>,  <tt@mit.jyu.fi> wrote:
> >Is there some simple expression that returns the maximum
> >value of a list?

use List::Util qw(max);
max(LIST);
 
> Personally, I think Perl needs a built-in list folding function,
> like...

        ... List::Util::reduce()

ISTR that much of List::Util will be built-in in later versions[1] of
Perl but that they won't be in the namespace default, you (will) need
to import them with "use builtin".

[1] Can't recall if it's in 5.7

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


------------------------------

Date: 5 Apr 2001 07:17:34 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: maximum value of a list
Message-Id: <9ahnou$b6o$1@boomer.cs.utexas.edu>

In article <m1n19vob6v.fsf@halfdome.holdit.com>,
Randal L. Schwartz <merlyn@stonehenge.com> wrote:
>>>>>> "Logan" == Logan Shaw <logan@cs.utexas.edu> writes:
>
>Logan> Personally, I think Perl needs a built-in list folding function, like
>
>Simple enough... and it's already written:
>
>    use List::Util qw(reduce); # in the CPAN
>    $sum = reduce { $a + $b } qw{ 10 20 30 40 50 60 70 80 90 };

Aha!  I will have to go check it out[1].

>Logan> Actually, it would be best to allow fold to have an identity
>Logan> value for whatever function as well, i.e. it'd be nice to have
>Logan> a version of fold like the one above and one like this:
>
>Identity is just the first element passed into the list!

That's great unless the list is empty.  It's really how
you define things, but in lots of cases it's best for the
sum of an empty list to be zero, rather than undefined.

Plus, another possible enhancement would be to specify
whether it's "right-associative" or "left-associative" You
can view a list-reducing (-folding) function as just like
inserting an operator between each of the elements, so that

	reduce { $a + $b } qw{ 10 20 30 40 50 60 70 80 90 };

is essentially

	10 + 20 + 30 + 40 + 50 + 60 + 70 + 80 + 90

But, is that left assocative or right associative?  I.e. is it
this?

	((((((((10 + 20) + 30) + 40) + 50) + 60) + 70) + 80) + 90)

Or this?

	(10 + (20 + (30 + (40 + (50 + (60 + (70 + (80 + 90))))))))

With addition, it doesn't matter, but with other operations it can make
a difference.  So, it'd be nice to have a way to choose one or the
other.

  - Logan

[1]  Sometime when I'm not suffering from sleep deprivation.  It's
     7:00am and I'm awake, and it's not because I'm up *early*...
-- 
whose?  my  your   his  her   our   their   _its_
who's?  I'm you're he's she's we're they're _it's_


------------------------------

Date: 05 Apr 2001 06:04:11 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: maximum value of a list
Message-Id: <m1r8z7mras.fsf@halfdome.holdit.com>

>>>>> "Logan" == Logan Shaw <logan@cs.utexas.edu> writes:

>> Identity is just the first element passed into the list!

Logan> That's great unless the list is empty.  It's really how
Logan> you define things, but in lots of cases it's best for the
Logan> sum of an empty list to be zero, rather than undefined.

I said this.  *first element*.  Do this.

  my $result = sum 0, @list_of_possibly_empty_size;

The first element is the identity element, used when the rest of the
list is empty.

Logan> Plus, another possible enhancement would be to specify
Logan> whether it's "right-associative" or "left-associative" You
Logan> can view a list-reducing (-folding) function as just like
Logan> inserting an operator between each of the elements, so that

Logan> 	reduce { $a + $b } qw{ 10 20 30 40 50 60 70 80 90 };

Logan> is essentially

Logan> 	10 + 20 + 30 + 40 + 50 + 60 + 70 + 80 + 90

Logan> But, is that left assocative or right associative?  I.e. is it
Logan> this?

In List::Util's case, it's left-to-right.  It wouldn't be hard
to copy the code and make it right-to-left though.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


------------------------------

Date: 5 Apr 2001 05:34:31 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: Newbies welcome
Message-Id: <9ahhnn$atr$1@boomer.cs.utexas.edu>

In article <MqXy6.2$8J2.1187@vic.nntp.telstra.net>,
Wyzelli <wyzelli@yahoo.com> wrote:
>"A_Geekette" <moiraine{NOSPAM}@qwest.net> wrote in message
>news:3ACB0843.24346AEE@qwest.net...
>>
>> "Nothing is impossible, no matter how improbable."
>> -Anonymous
>
>I'd like to see you cut down a Californian Redwod using a banana.

Sure, just give me lots of liquid nitrogen and a few tools (maybe a
sawblade that won't crack at extreme low temperatures), and I think I
could probably do it, although not quickly.

Now, if you'd said "I'd like to see you cut down a mature California
Redwood using only a banana in less than 8 hours", I would have to
admit I can't do it.

  - Logan
-- 
whose?  my  your   his  her   our   their   _its_
who's?  I'm you're he's she's we're they're _it's_


------------------------------

Date: Thu, 05 Apr 2001 10:57:47 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: Newbies welcome
Message-Id: <slrn9conp8.4d6.tjla@thislove.dyndns.org>

I was shocked! How could Logan Shaw <logan@cs.utexas.edu>
say such a terrible thing:
>In article <MqXy6.2$8J2.1187@vic.nntp.telstra.net>,
>Wyzelli <wyzelli@yahoo.com> wrote:
>>"A_Geekette" <moiraine{NOSPAM}@qwest.net> wrote in message
>>news:3ACB0843.24346AEE@qwest.net...
>>>
>>> "Nothing is impossible, no matter how improbable."
>>> -Anonymous
>>
>>I'd like to see you cut down a Californian Redwod using a banana.
>
>Sure, just give me lots of liquid nitrogen and a few tools (maybe a
>sawblade that won't crack at extreme low temperatures), and I think I
>could probably do it, although not quickly.
>
>Now, if you'd said "I'd like to see you cut down a mature California
>Redwood using only a banana in less than 8 hours", I would have to
>admit I can't do it.

You just lack the imagination required to perform the job. I would
electrically charge the frozen banana and then accelerate it to near
lightspeed in a particle accelerator which was aimed at the base of the
tree. A few passes and the trunk of the tree will separate from the
roots. Simple.

-- 
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
"The impotence of God is infinite."
       [Anatole France]
  Atheism/Freethought fortune cookie file


------------------------------

Date: Thu, 5 Apr 2001 11:01:28 +0000 (UTC)
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: Newbies welcome
Message-Id: <slrn9cok31.vpn.bernard.el-hagin@gdndev32.lido-tech>

On Thu, 05 Apr 2001 10:57:47 GMT, Gwyn Judd <tjla@guvfybir.qlaqaf.bet> wrote:
>I was shocked! How could Logan Shaw <logan@cs.utexas.edu>
>say such a terrible thing:
>>In article <MqXy6.2$8J2.1187@vic.nntp.telstra.net>,
>>Wyzelli <wyzelli@yahoo.com> wrote:
>>>"A_Geekette" <moiraine{NOSPAM}@qwest.net> wrote in message
>>>news:3ACB0843.24346AEE@qwest.net...
>>>>
>>>> "Nothing is impossible, no matter how improbable."
>>>> -Anonymous
>>>
>>>I'd like to see you cut down a Californian Redwod using a banana.
>>
>>Sure, just give me lots of liquid nitrogen and a few tools (maybe a
>>sawblade that won't crack at extreme low temperatures), and I think I
>>could probably do it, although not quickly.
>>
>>Now, if you'd said "I'd like to see you cut down a mature California
>>Redwood using only a banana in less than 8 hours", I would have to
>>admit I can't do it.
>
>You just lack the imagination required to perform the job. I would
>electrically charge the frozen banana and then accelerate it to near
>lightspeed in a particle accelerator which was aimed at the base of the
>tree. A few passes and the trunk of the tree will separate from the
>roots. Simple.

Aren't you, at this point, cutting down a California Redwood using a
banana *and* a particle accelerator?

Cheers,
Bernard
--
#requires 5.6.0
perl -le'* = =[[`JAPH`]=>[q[Just another Perl hacker,]]];print @ { @ = [$ ?] }'


------------------------------

Date: 5 Apr 2001 11:36:31 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Newbies welcome
Message-Id: <9ahlbv$sf8$1@mamenchi.zrz.TU-Berlin.DE>

According to Gwyn Judd <tjla@guvfybir.qlaqaf.bet>:
> I was shocked! How could Logan Shaw <logan@cs.utexas.edu>
> say such a terrible thing:
> >In article <MqXy6.2$8J2.1187@vic.nntp.telstra.net>,
> >Wyzelli <wyzelli@yahoo.com> wrote:
> >>"A_Geekette" <moiraine{NOSPAM}@qwest.net> wrote in message
> >>news:3ACB0843.24346AEE@qwest.net...
> >>>
> >>> "Nothing is impossible, no matter how improbable."
> >>> -Anonymous
> >>
> >>I'd like to see you cut down a Californian Redwod using a banana.
> >
> >Sure, just give me lots of liquid nitrogen and a few tools (maybe a
> >sawblade that won't crack at extreme low temperatures), and I think I
> >could probably do it, although not quickly.
> >
> >Now, if you'd said "I'd like to see you cut down a mature California
> >Redwood using only a banana in less than 8 hours", I would have to
> >admit I can't do it.
> 
> You just lack the imagination required to perform the job. I would
> electrically charge the frozen banana and then accelerate it to near
> lightspeed in a particle accelerator which was aimed at the base of the
> tree. A few passes and the trunk of the tree will separate from the
> roots. Simple.

I'd use the banana to lure...

Oh...  Can I have more bananas?  A truckload or two?

Anno


------------------------------

Date: Thu, 05 Apr 2001 11:57:43 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: Newbies welcome
Message-Id: <slrn9cor9k.4m9.tjla@thislove.dyndns.org>

I was shocked! How could Bernard El-Hagin <bernard.el-hagin@lido-tech.net>
say such a terrible thing:
>On Thu, 05 Apr 2001 10:57:47 GMT, Gwyn Judd <tjla@guvfybir.qlaqaf.bet> wrote:
>>I was shocked! How could Logan Shaw <logan@cs.utexas.edu>
>>say such a terrible thing:
>>>In article <MqXy6.2$8J2.1187@vic.nntp.telstra.net>,
>>>Wyzelli <wyzelli@yahoo.com> wrote:
>>>>"A_Geekette" <moiraine{NOSPAM}@qwest.net> wrote in message
>>>>news:3ACB0843.24346AEE@qwest.net...
>>>>>
>>>>> "Nothing is impossible, no matter how improbable."
>>>>> -Anonymous
>>>>
>>>>I'd like to see you cut down a Californian Redwod using a banana.
>>>
>>>Sure, just give me lots of liquid nitrogen and a few tools (maybe a
>>>sawblade that won't crack at extreme low temperatures), and I think I
>>>could probably do it, although not quickly.
>>>
>>>Now, if you'd said "I'd like to see you cut down a mature California
>>>Redwood using only a banana in less than 8 hours", I would have to
>>>admit I can't do it.
>>
>>You just lack the imagination required to perform the job. I would
>>electrically charge the frozen banana and then accelerate it to near
>>lightspeed in a particle accelerator which was aimed at the base of the
>>tree. A few passes and the trunk of the tree will separate from the
>>roots. Simple.
>
>Aren't you, at this point, cutting down a California Redwood using a
>banana *and* a particle accelerator?

I believe I can honestly say I never expected anyone would ever ask me
that question when I was growing up.

-- 
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
There are two sides to every divorce: yours and the shithead's.


------------------------------

Date: 5 Apr 2001 07:34:50 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: Newbies welcome
Message-Id: <9ahopa$b9d$1@boomer.cs.utexas.edu>

In article <9ahlbv$sf8$1@mamenchi.zrz.TU-Berlin.DE>,
Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
>> >In article <MqXy6.2$8J2.1187@vic.nntp.telstra.net>,
>> >Wyzelli <wyzelli@yahoo.com> wrote:
>> >>"A_Geekette" <moiraine{NOSPAM}@qwest.net> wrote in message
>> >>news:3ACB0843.24346AEE@qwest.net...
>> >>> "Nothing is impossible, no matter how improbable."

>> >>I'd like to see you cut down a Californian Redwod using a banana.
>
>I'd use the banana to lure...
>
>Oh...  Can I have more bananas?  A truckload or two?

Well, if given a great quantity of bananas and maybe some rope and
string, all you've got to do is keep hanging more and more bananas from
the tree, preferably all on one side.  Pretty soon, well... you know
what happens to trees in the winter when their branches collect too
much ice.

  - Logan
-- 
whose?  my  your   his  her   our   their   _its_
who's?  I'm you're he's she's we're they're _it's_


------------------------------

Date: Thu, 05 Apr 2001 07:38:58 -0500
From: Cameron Dorey <camerond@mail.uca.edu>
Subject: Re: Newbies welcome
Message-Id: <3ACC6762.6E1C344D@mail.uca.edu>

Bernard El-Hagin wrote:
> 
> On Thu, 05 Apr 2001 10:57:47 GMT, Gwyn Judd <tjla@guvfybir.qlaqaf.bet> wrote:
> >I was shocked! How could Logan Shaw <logan@cs.utexas.edu>
> >say such a terrible thing:
> >>In article <MqXy6.2$8J2.1187@vic.nntp.telstra.net>,
> >>Wyzelli <wyzelli@yahoo.com> wrote:
> >>>
> >>>I'd like to see you cut down a Californian Redwod using a banana.
> >>
> >
> >You just lack the imagination required to perform the job. I would
> >electrically charge the frozen banana and then accelerate it to near
> >lightspeed in a particle accelerator which was aimed at the base of the
> >tree. A few passes and the trunk of the tree will separate from the
> >roots. Simple.
> 
> Aren't you, at this point, cutting down a California Redwood using a
> banana *and* a particle accelerator?

Actually, he didn't say "using _only_ a banana." I'd use the banana as
an energy source (for me) before I picked up an appropriately-sized
chain saw to finish the job (preparation is here a very important step). 

Cameron

-- 
Cameron Dorey
Associate Professor of Chemistry
University of Central Arkansas
Phone: 501-450-5938
camerond@mail.uca.edu


------------------------------

Date: Thu, 5 Apr 2001 13:04:25 +0000 (UTC)
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: Newbies welcome
Message-Id: <slrn9cor9h.vpn.bernard.el-hagin@gdndev32.lido-tech>

On Thu, 05 Apr 2001 07:38:58 -0500, Cameron Dorey <camerond@mail.uca.edu> wrote:
>Bernard El-Hagin wrote:
>> 
>> On Thu, 05 Apr 2001 10:57:47 GMT, Gwyn Judd <tjla@guvfybir.qlaqaf.bet> wrote:
>> >I was shocked! How could Logan Shaw <logan@cs.utexas.edu>
>> >say such a terrible thing:
>> >>In article <MqXy6.2$8J2.1187@vic.nntp.telstra.net>,
>> >>Wyzelli <wyzelli@yahoo.com> wrote:
>> >>>
>> >>>I'd like to see you cut down a Californian Redwod using a banana.
>> >>
>> >
>> >You just lack the imagination required to perform the job. I would
>> >electrically charge the frozen banana and then accelerate it to near
>> >lightspeed in a particle accelerator which was aimed at the base of the
>> >tree. A few passes and the trunk of the tree will separate from the
>> >roots. Simple.
>> 
>> Aren't you, at this point, cutting down a California Redwood using a
>> banana *and* a particle accelerator?
>
>Actually, he didn't say "using _only_ a banana." I'd use the banana as
>an energy source (for me) before I picked up an appropriately-sized
>chain saw to finish the job (preparation is here a very important step). 

Why would you need a chainsaw when you've got a banana? Chemistry
professors. Sheesh!

Cheers,
Bernard
--
#requires 5.6.0
perl -le'* = =[[`JAPH`]=>[q[Just another Perl hacker,]]];print @ { @ = [$ ?] }'


------------------------------

Date: Thu, 5 Apr 2001 12:35:57 +0100
From: "Paul  Groves" <paul.groves@oucs.ox.ac.uk>
Subject: Re: Perl training courses in the UK?
Message-Id: <9ahl9k$jmm$1@news.ox.ac.uk>



--
---
"The Mosquito ScriptKiddiot" <anotherway83@aol.com> wrote in message
news:20010404204537.20371.00004424@ng-mq1.aol.com...
> y r u wasting ur money on a course, get LEARNING PERL and PROGRAMMING
> PERL....they're awesum

I found Learning Perl to be fine for the first half, but it suddenly leaps
into difficult and unfamiliar concepts very quickly - does it assume you
have done C programming first?




------------------------------

Date: Thu, 5 Apr 2001 12:22:03 +0000 (UTC)
From: abigail@foad.org (Abigail)
Subject: Re: Please Flame my Benchmark: open vs. cat
Message-Id: <slrn9coorb.ell.abigail@tsathoggua.rlyeh.net>

Dave Bailey (dave@sydney.daveb.net) wrote on MMDCCLXXIII September
MCMXCIII in <URL:news:slrn9cmlmt.a0d.dave@sydney.daveb.net>:
,, On Wed, 4 Apr 2001 10:11:13 +0000 (UTC), Abigail <abigail@foad.org> wrote:
,, >Dave Bailey (dave@sydney.daveb.net) wrote on MMDCCLXXIII September
,, >MCMXCIII in <URL:news:slrn9cklep.71p.dave@sydney.daveb.net>:
,, >;; On Tue, 03 Apr 2001 23:46:13 -0000, Chris Stith 
,, >;; <mischief@velma.motion.net> wrote:
,, >;; >The fact that Abigail doesn't think it's normal to read the same
,, >;; >file for contents several thousand times in a program doesn't mean
,, >;; >she doesn't recognize the value of a benchmark. 
,, >;; 
,, >;; I didn't say that.  I was referring to her implication that the program
,, >;; which inspired the benchmark did this ("If I need a string 10,000 times
,, >;; in a program..."), and should be redesigned.  That was never indicated 
,, >;; by the original poster.  Perhaps all the program did was slurp a file 
,, >;; into a scalar and then exit.  It doesn't matter.  The question was, is it 
,, >;; faster to perform this task by backticking cat, or by slurping from Perl?
,, [...]
,, >For a single read, the difference between a backticked cat and slurping
,, >from Perl is as irrelevant as the question how many angles can dance on
,, >the tip of a needle. Because the time will be dominated by the disk read.
,, 
,, Yes, but after 10,000 reads, we finally see that the difference between
,, the two methods is essentially the time required for a fork() - which, 
,, apparently, would be a novel concept to the original poster's coworkers.

But that time is totally irrelevant, as it is dwarved by the disc access
time. Which was factored out. The benchmark suggest that open() is much
faster then `cat`. But it isn't, as the difference is nothing compared
to the disk access.

,, Since that is the essence of their misunderstanding, I feel that the 
,, benchmark is appropriate and sufficient to settle the disagreement.  It
,, is true that the extent to which the methods differ is dependent on the
,, size of the file being read (since cat does a memmove() to transfer the
,, input buffer to the output buffer), but the reality of the situation is
,, that a more detailed and thorough comparison of the two methods, while 
,, perhaps of use to you, would merely confuse the issue to the "cow orkers".

The fault lies with *both* parties, thinking the time difference matters.
It doesn't.

,, >;; There are lots of situations in computational physics where the inner 
,, >;; loop of a computation includes a division by something (say, x) which 
,, >;; is computed in an outer loop.  Such a computation can be made faster 
,, >;; by computing the reciprocal of x (call it y) in the outer loop and 
,, >;; replacing the inner-loop division by x with a multiplication by y.  
,, [...]
,, >Keyword "inner loop". Any program that does the same operation repeatedly
,, >in an inner loop has something that can be optimized away. 
,, 
,, I'd love to see you "optimize" the Gauss-Jordan elimination algorithm in
,, this manner.  See, for example, "Numerical Recipes in C", 2nd ed., p. 39
,, (near the bottom of the page) for a precise example of precomputation of 
,, a reciprocal to speed up loop processing:


Eh, which statement do you mean? As far as I can see, all statements
in inner loops depend directly or indirectly on the variant of the most
inner enclosing loop. And hence, they are not the same operation.



Abigail


------------------------------

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V10 Issue 634
**************************************


home help back first fref pref prev next nref lref last post