Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re^3: How will you use state declared variables in Perl6?

by Juerd (Abbot)
on Nov 05, 2006 at 23:50 UTC ( #582344=note: print w/replies, xml ) Need Help??


in reply to Re^2: How will you use state declared variables in Perl6?
in thread How will you use state declared variables in Perl6?

My point was that you'd use standard memoization for that, not your own mechanism. In other words: state will (as far as I can estimate) not be used much for memoization, because it's easier to just say "is memoized" or something alike.

Juerd # { site => 'juerd.nl', do_not_use => 'spamtrap', perl6_server => 'feather' }

  • Comment on Re^3: How will you use state declared variables in Perl6?

Replies are listed 'Best First'.
Re^4: How will you use state declared variables in Perl6?
by TimToady (Parson) on Nov 06, 2006 at 06:07 UTC
    That's currently specced as "is cached" though I don't believe it's implemented yet. However, even after it's implemented, it's not going to be smart enough from the type signature to know whether an incoming parameter is sparse or dense, and for something like fibonacci an array is going to provide a faster memo cache than a hash is. Maybe the memoizing code can be smart enough to figure that out heuristically, but that's not a sure thing at this point.

      I have to admit that I'm dreaming of a code profiler that also tries some optimization strategies, and picks the best for your program. Memoization is already heavily parametrized, and I expect the same things to be possible with "is cached". Perhaps "use a dense array" can be communicated in an argument passed to "is cached"?

      Juerd # { site => 'juerd.nl', do_not_use => 'spamtrap', perl6_server => 'feather' }

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://582344]
help
Chatterbox?
[Discipulus]: and in the wanted sub you just calculate the duretion and add it the total, stop
[shmem]: sub wanted { push @files, $File::Find::name if $File::Find::name =~/\.mp3$/ }
[Lady_Aleena]: shmem, that is understandable! The two examples in File::Find don't make sense to me on a quick glance.
[marioroy]: LA if the find worked from Unix command line, or does it not. Likely a quoting issue inside Perl qx.
[Lady_Aleena]: marioroy, the find worked fine at the command line.

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (9)
As of 2017-04-23 20:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I'm a fool:











    Results (432 votes). Check out past polls.