タグ

関連タグで絞り込む (1)

タグの絞り込みを解除

perlとメモ化に関するkiyo_hikoのブックマーク (2)

  • When perl is not quite fast enough

    This is the script for my talk at YAPC::EU::2002. It's not a transcript of what I actually said; rather it collects together the notes that were in the pod source to the slides, the notes scribbled on various bits of paper, the notes that were only in my head, and tries to make a coherent text. I've also tried to add in the useful feedback I got - sometimes I can even remember who said it and so g

  • use Memoize; - FloralCompany.log

    perl(v5.7.3以降) の標準モジュールに Memoize というのがある。何をするやつかというと、perldoc 曰く Make functions faster by trading space for time 「(計算)時間と(メモリ等の)領域とを取引して、関数を早くします」ということで、メモ化を行ってくれるモジュールです。 百聞は一見に如かず。というわけで、(Benchmark使うんでcodepadは自重 use strict; use Memoize; use Benchmark 'timethese'; sub collatz { my $n = shift; $n == 1 ? 0 : 1+collatz( $n%2 ? $n*3+1 : $n/2 ); } sub fibonacci { my $n = shift; $n <= 2 ? 1 : fibonacci(

    kiyo_hiko
    kiyo_hiko 2013/04/19
    perlでメモ化 // 対象に副作用があるとだめ
  • 1