タグ

closureに関するperezvonのブックマーク (4)

  • Table,Caching,Memoize,Closure,Profiler - koyachiの日記

    入力に対して決まった値を返し、入力値のレンジが広く、何度も値を取得する必要がある場合、Cなんかでは初期化時に全入力値に対する結果を保持するテーブルを生成したりします。速度重視する場合のsinテーブルとか。割と制約がシビアでない環境では、新しい入力パラメタが与えられるたびに値を保存する関数でもいいと思います。 my %cache; sub fast_sin { return $cache{ $_[0] } if exists $cache{ $_[0] }; $cache{ $_[0] } = sin( $_[0] ); }PerlのMemoizeモジュールや、JSANのMemoizeモジュールを使うとこのキャッシング機能を毎回書く必要がなくなります。Perlの場合は、 use Memoize; memoize 'sin';とするだけでsin関数にキャッシュ機構が組込まれます。 Perlでの

    Table,Caching,Memoize,Closure,Profiler - koyachiの日記
  • Joe Walnes, The power of closures in C# 2.0

    Mock Roles, not Objects October 26 2004, Vancouver, Canada. OOPSLA'04 Personal Development Practices Map June 24 2004, Salt Lake City, Utah. Agile Development Conference SiteMesh.NET and ASP.NET MasterPages May 20 2004, Bangalore, India. Bangalore .NET User Group Mock Objects: Driving Top Down Development March 29 2004, St Neots, UK. OT2004 Mock Objects December 2 2003, London, UK. XP Day 3 T

  • Ivan: Closures in Python (part 1)

    Closures in Python (part 1) Martin Fowler (obligitary Fowlbot namedrop) recently blogged about the power of closures in languages that support them. Here's a translation of Martin's Ruby code into Python. [Initial sentence and table structure copied from Joe Walnes] (not knowing how to get this to format correctly is my fault. I want to write a part 2, but that'll have to wait as I have other comm

  • Martin Fowler's Bliki in Japanese - クロージャ

    http://martinfowler.com/bliki/Closure.html 動的言語に興味がでてくると、 クロージャやブロックと呼ばれる概念に出会うと思います。 C/C++/Java/C# などクロージャを持たない言語をご使用の方は、 どういったものなのかご存知ないかもしれません。 ここでは簡単にクロージャについて説明します。 クロージャを持った素晴らしい言語を使ったことある方にとっては、 あまり面白くない話かもしれません。 クロージャは長年使用されてきました。 私が最初に出会ったのは、おそらく Smalltalk だったと思います。 Smalltalk ではブロックと呼んでいました。 Lisp ではクロージャを多用しています。 Ruby でもクロージャが提供されています――多くの rubyist がスクリプト言語に Ruby を選ぶのはこのためです。 基的にクロージャとは、ブ

  • 1