SPUG: Time::Like::Loops idea (was: Those magic commands that Damian used)

Adam Monsen adamm at wazamatta.com
Sat Jul 20 19:55:04 CDT 2002

On 20/07/02 08:17 -0700, Damian Conway wrote:
> Andy wrote:
> > I noticed at last Tuesday's meeting that Damian
> > used the command "pmd" at his Mac OS X shell prompt.
>     % alias pmd
>         cd `filemoddir !:1-$`

Now if only someone could trick him into printing the output of

% perldoc -m Time::Space::Continuum


% perldoc -m Time::Like::Loops


...but seriously, I think I have one far-fetched idear on how that stuff

E=mc^2 says we can trade matter for energy with the speed of light
remaining constant, correct? So, if we consider matter to be something
like hard disk space and energy to be something like CPU cycles, the two
are roughly interchangeable whilst processing speed (c) remains
constant. This would lead me to believe that some kind of caching is
being done, and hard disk space is being interchanged with CPU cycles.
It would appear to the casual observer that we are actually reducing the
number of CPU cycles by increasing processing speed, but processing
speed _must_ be constant.

This code seems to produce the same effect as Time::Like::Loops (time it!)...

    #!/usr/bin/perl -w
    use strict;
    use DB_File;
    use Memoize;
    tie my %cache => 'DB_File', 'money.db', O_RDWR|O_CREAT, 0666;
    memoize('fib', SCALAR_CACHE => [HASH => \%cache]);
    sub fib {
      my $n = shift;
      return $n if $n < 2;
      fib($n-1) + fib($n-2);
    print fib($_), "\n" for 1 .. 70;

So, maybe Time::Like::Loops somehow turns on memoize() for the functions
that are called within a "whilst" or a "fort" loop, for instance.

I think Asim may be right about sleep() being overloaded to a no-op; I
have no idea what this would entail.

Adam Monsen

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
      Subscriptions; Email to majordomo at pm.org:  ACTION  LIST  EMAIL
  Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
 For daily traffic, use spug-list for LIST ;  for weekly, spug-list-digest
     Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org

More information about the spug-list mailing list