タグ

2012年5月21日のブックマーク (1件)

  • 極めるイテレータ

    $Id: iterator.rd,v 1.5 2003/06/18 23:28:28 aamine Exp $ Ruby の最大の特徴であり難関でもあるイテレータを極めちゃうぜ講座。 イテレータとはなにか 最初に言っておくと、最近の Ruby 界では「イテレータ」という名称はあんま し好まれてない。くりかえさないイテレータが増えてきたっていうのが理由だ。 ではなんと呼べばいいのかっていうと、「ブロック付きメソッド」とか言うらしい。 どうも好きじゃないなあこの名称。 じゃあどんな名称だったらいいのか。 原点に立ち戻ってイテレータとはなにかと考えると、「制御構造を作るメソッ ド」なのだ。それは以下のような例を見れば感覚的に「あー、そうなのか」と わかる。 def IF( cond ) yield if cond end IF (i > 4) { puts 'ok' } そんなわけで、原理を考え

    bufferings
    bufferings 2012/05/21
    あとでよむぞー!
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy