[#12543] Ruby Conference 0.3 — greentea@...2.so-net.ne.jp (Tomoyuki Kosimizu)

こんにちは、こしみずです。

21 messages 1999/03/04
[#12570] Re: Ruby Conference 0.3 — matz@... (Yukihiro Matsumoto) 1999/03/05

まつもと ゆきひろです

[#12571] Re: Ruby Conference 0.3 — Takaaki Higuchi - Technology Marketing <Takaaki.Higuchi@...> 1999/03/05

> | >18日あたり東京でRuby Conference 0.3(単なる宴会)を開きましょうか?

[#12577] Re: Ruby Conference 0.3 — matz@... (Yukihiro Matsumoto) 1999/03/05

まつもと ゆきひろです

[#12645] Re: Ruby Conference 0.3 — KIMURA Koichi <kimura@...> 1999/03/08

[#12546] [閑話] Ruby Conference 0.3 参加したいぃ — Atsuko Yoshida <atsuko@...>

こんにちは。あつこです。

17 messages 1999/03/05
[#12548] Re: [ 閑話] Ruby Conference 0.3 参加したいぃ — KIMURA Koichi <kimura@...> 1999/03/05

[#12573] alternative name of iterator — Shugo Maeda <shugo@...>

前田です。

49 messages 1999/03/05
[#12584] Re: alternative name of iterator — matz@... (Yukihiro Matsumoto) 1999/03/05

まつもと ゆきひろです

[#12641] Re: alternative name of iterator — moochan <moochan@...> 1999/03/08

moochan です.

[#12642] Re: alternative name of iterator — matz@... (Yukihiro Matsumoto) 1999/03/08

まつもと ゆきひろです

[#12643] Re: alternative name of iterator — moochan <moochan@...> 1999/03/08

moochan です.

[#12644] Re: alternative name of iterator — matz@... (Yukihiro Matsumoto) 1999/03/08

まつもと ゆきひろです

[#12661] Re: alternative name of iterator — moochan <moochan@...> 1999/03/09

moochan です.

[#12662] Re: alternative name of iterator — matz@... (Yukihiro Matsumoto) 1999/03/09

まつもと ゆきひろです

[#12666] Re: alternative name of iterator — moochan <moochan@...> 1999/03/09

moochan です.

[#12590] kconv SJIS — Kikutani Makoto <kikutani@...>

=?ISO-2022-JP?B? ではじまるBエンコードされたサブジェクトは

20 messages 1999/03/06

[#12695] 第 2 回 OMG 分散コンピューティング・セミナー: CORBA3.0 の詳説と CORBA 活用の実際 — Junichi Suzuki <jun-sk@...>

各位.

19 messages 1999/03/10
[#12911] HORB for Ruby? — Shugo Maeda <shugo@...> 1999/03/16

前田です。

[#12707] Re: operater bind order ? — Inaba Hiroto <inaba@...>

稲葉です.

16 messages 1999/03/10
[#12709] Re: operater bind order ? — KIMURA Koichi <kimura@...> 1999/03/10

[#12727] Making of Interval class. — moochan <moochan@...>

moochan です.

40 messages 1999/03/10
[#12742] Re: Making of Interval class. — Shugo Maeda <shugo@...> 1999/03/11

前田です。

[#12746] Re: Making of Interval class. — moochan <moochan@...> 1999/03/11

moochan です.

[#12728] Time + 1M — Wakou Aoyama <wakou@...>

青山です。

30 messages 1999/03/10
[#12731] Re: Time + 1M — Tadayoshi Funaba <tadf@...> 1999/03/10

ふなばです。

[#12772] Re: Time + 1M — IKARASHI Akira <ikarashi@...> 1999/03/11

五十嵐です。

[#12774] Re: Time + 1M — Tadayoshi Funaba <tadf@...> 1999/03/11

ふなばです。

[#12775] Re: Time + 1M — IKARASHI Akira <ikarashi@...> 1999/03/11

五十嵐です。

[#12850] Ruby Conference 0.3 where ? when ? — ISII takesi <isii@...>

石井です。

89 messages 1999/03/15
[#12852] Re: Ruby Conference 0.3 where ? when ? — matz@... (Yukihiro Matsumoto) 1999/03/15

まつもと ゆきひろです

[#12859] Re: Ruby Conference 0.3 where ? when ? — hisanori@... 1999/03/15

松尾です。

[#12860] Re: Ruby Conference 0.3 where ? when ? — matz@... (Yukihiro Matsumoto) 1999/03/15

まつもと ゆきひろです

[#12861] Re: Ruby Conference 0.3 where ? when ? — hisanori@... 1999/03/15

松尾です。

[#12862] Re: Ruby Conference 0.3 where ? when ? — "NAKAMURA, Hiroshi" <nakahiro@...> 1999/03/15

なひです.

[#12864] Re: Ruby Conference 0.3 where ? when ? — matz@... (Yukihiro Matsumoto) 1999/03/15

まつもと ゆきひろです

[#12870] Re: Ruby Conference 0.3 where ? when ? — "NAKAMURA, Hiroshi" <nakahiro@...> 1999/03/15

なひです.

[#12872] Re: Ruby Conference 0.3 where ? when ? — matz@... (Yukihiro Matsumoto) 1999/03/15

まつもと ゆきひろです

[#12888] signal handler in Ruby ( was Re: Ruby Conference 0.3 where ? when ? ) — "NAKAMURA, Hiroshi" <nakahiro@...> 1999/03/15

なひです.

[#12896] Re: signal handler in Ruby ( was Re: Ruby Conference 0.3 where ? when ? ) — matz@... (Yukihiro Matsumoto) 1999/03/16

まつもと ゆきひろです

[#12960] Re: signal handler in Ruby ( was Re: Ruby Conference 0.3 where ? when ? ) — "NAKAMURA, Hiroshi" <nakahiro@...> 1999/03/17

なひです.

[#12962] Re: signal handler in Ruby ( was Re: Ruby Conference 0.3 where ? when ? ) — 中村暁史 <anakamur@...> 1999/03/17

[#12993] Re: signal handler in Ruby ( was Re: Ruby Conference 0.3 where ? when ? ) — "NAKAMURA, Hiroshi" <nakahiro@...> 1999/03/18

なひです.

[#12995] Re: signal handler in Ruby ( was Re: Ruby Conference 0.3 where ? when ? ) — 中村暁史 <anakamur@...> 1999/03/18

[#13009] Re: signal handler in Ruby ( was Re: Ruby Conference 0.3 where ? when ? ) — "NAKAMURA, Hiroshi" <nakahiro@...> 1999/03/19

なひです.

[#13010] Re: signal handler in Ruby ( was Re: Ruby Conference 0.3 where ? when ? ) — "NAKAMURA, Hiroshi" <nakahiro@...> 1999/03/19

なひです.

[#13011] Re: signal handler in Ruby ( was Re: Ruby Conference 0.3 where ? when ? ) — KIMURA Koichi <kimura@...> 1999/03/19

[#13013] Re: signal handler in Ruby( was Re: Ruby Conference 0.3 where ? when ? ) — "NAKAMURA, Hiroshi" <nakahiro@...> 1999/03/19

なひです.

[#13016] Re: signal handler in Ruby( was Re: Ruby Conference 0.3 where ? when ? ) — 中村暁史 <anakamur@...> 1999/03/19

[#13023] Re: signal handler in Ruby( was Re: Ruby Conference 0.3 where ? when ? ) — "NAKAMURA, Hiroshi" <nakahiro@...> 1999/03/19

なひです.

[#13012] Re: signal handler in Ruby ( was Re: Ruby Conference 0.3 where ? when ? ) — 中村暁史 <anakamur@...> 1999/03/19

[#13037] Re: signal handler in Ruby ( was Re: Ruby Conference 0.3 where ? when ? ) — keiju@... (石塚圭樹 ) 1999/03/20

けいじゅ@日本ラショナルソフトウェアです.

[#12918] Sieve of Eratosthenes (Re: [ruby-dev:6094]) — Shin-ichiro Hara <sinara@...>

原です。

29 messages 1999/03/16
[#12924] delete during each (Re: Sieve of Eratosthenes) — matz@... (Yukihiro Matsumoto) 1999/03/17

まつもと ゆきひろです

[#12930] Re: delete during each (Re: Sieve of Eratosthenes) — Shin-ichiro Hara <sinara@...> 1999/03/17

原です。

[#12932] Re: delete during each (Re: Sieve of Eratosthenes) — matz@... (Yukihiro Matsumoto) 1999/03/17

まつもと ゆきひろです

[#12934] Re: delete during each (Re: Sieve of Eratosthenes) — Shin-ichiro Hara <sinara@...> 1999/03/17

原です。

[#13091] FAQ for /:|) — matz@... (Yukihiro Matsumoto)

まつもと ゆきひろです

17 messages 1999/03/23

[#13121] 全角文字列の分割方法について — goto@...

初めまして、後藤@横河工事(橋梁技術者)です。

17 messages 1999/03/24
[#13122] Re: 全角文字列の分割方法について — matz@... (Yukihiro Matsumoto) 1999/03/24

まつもと ゆきひろです

[#13123] Re: 全角文字列の分割方法について — goto@... 1999/03/24

後藤@横河工事(橋梁技術者)です。お世話になります。

[#13134] ロックでアドバイスをいただきたいのですが — Keisuke Minami <keisuke@...>

はじめまして。三並と申します。

30 messages 1999/03/24
[#13136] Re: ロックでアドバイスをいただきたいのですが — hisanori@... 1999/03/24

松尾です。

[#13139] Re: ロックでアドバイスをいただきたいのですが — 中村暁史 <anakamur@...> 1999/03/24

[#13188] CGI (Re: ロックでアドバイスをいただきたいのですが) — Shugo Maeda <shugo@...> 1999/03/25

前田です。

[#13190] Re: CGI (Re: ロックでアドバイスをいただきたいのですが) — hisanori@... 1999/03/25

松尾です。

[#13140] Ruby Conference 0.3 — hisanori@...

松尾です。

25 messages 1999/03/24

[ruby-list:12801] R: Re: Making of Interval class.

From: moochan <moochan@...>
Date: 1999-03-12 08:28:54 UTC
List: ruby-list #12801
moochan です.

On Fri, 12 Mar 1999 10:53:33 +0900
Takashi Nakai <nakai@m1.sys.to.casio.co.jp> wrote:

>あと、こちらも個人的な好みなんですが、添付ファイルよりも
>本文中にあったほうが読みやすいので好きです。

あ.すみません.メーラ種別への配慮が足らなかったですね(^^;;;

と言うわけで,新たにメソッドを2点追加し,Intervalクラスの最新版
を本文へ流し込みます.

# あと若干,細かい調整も行いました.
# うわ〜.段々でかくなるなあ(^^;
-------------------------------------------------------------
・Intervalクラスの生成: Interval.new(s,e,step)
    s   : 始項
    e   : 終項(適当な値)
    step: ステップ(step>1,default:1)
・始値,終値,ステップの再設定: reset(s,e,step)
    引数はnewと同じ
・始項を得る: beginning()
・真の終項を得る: ending()
    一般に,ending() != e
・ステップを得る: step()
・ステップの再設定: step=(step)
    step: ステップ(step>1,default:1)
・任意項を得る: clause(n) or [](n)
    n: 添え字(n>0)
・次の項を得る: next()
・前の項を得る: prev()
・濃度を得る: size()
・距離を得る: length()
・最小項を得る: min()
・最大項を得る: max()
・全項を配列で得る: set()
・全項の総和を得る: sum()
・全項の平均値を得る: average()
・全項のイテレタを得る: each()
・全項の逆順配列を得る: reverse()
・素数だけの配列を得る: prime
(追加分)
・与えられたオブジェクトが包含されているか調べる: include?(c)
    c: 単項,または,Intervalのサブセット(Array)
    result: true:包含,false:非包含
・サブセットを得る: subset(s,n)
    s: 始項
    n: 個数
    result: Array のサブセット or nil
-------------------------------------------------------------
#!/usr/local/bin/ruby

class Interval
  def initialize(s,e,step=1)
    reset(s,e,step)
  end
  def reset(s,e,step=1)
    @begin, @end, @step = s, e, step
    @index = 0
    @direction =  1
    @direction = -1 if @begin > @end
    check_of_step
  end
  def check_of_step
    raise "Interval step value isn't positive." if @step <= 0
    raise "Interval step is too big." if (@end - @begin).abs < @step
  end
  private :check_of_step
  def beginning() return @begin end
  def ending() return @end end
  def step() return @step end
  def step=(step) @step = step; check_of_step end
  def clause(n)
    if n > 0
      @index = n
      ans = @begin + @direction * @step * (n - 1)
      return ans if @direction ==  1 and @begin <= ans and ans <= @end
      return ans if @direction == -1 and @begin >= ans and ans >= @end
    end
    raise "Error in bounds."
  end
  def [](n) clause(n) end
  def next() return clause(index + 1) end
  def prev() return clause(index - 1) end
  def index() return @index end
  private :index
  def size() return (@end - @begin).abs / @step + 1 end
  def length() return max - min end
  def min() return @begin if @direction ==  1; return clause(size) end
  def max() return @begin if @direction == -1; return clause(size) end
  def set
    ary = []
    for n in 1..size
      ary.push(clause(n))
    end
    return ary
  end
  def sum() return (min + max) * size / 2 end
  def average() return sum / size end
  def each
    for n in 1..size
      yield clause(n)
    end
  end
  def reverse() return set.reverse!  end
  def maximum(a,b) return a if a > b; return b end
  private :maximum
  def prime
    ary = [2]
    for i in 3..Math.sqrt(maximum(max.abs,min.abs))
      for j in ary
        if j > Math.sqrt(i)
          ary.push(i)
          break
        else
          break if i % j == 0
        end
      end
    end
    new = []
    for n in set
      m = n.abs
      next if m == 0 or m == 1
      flag = 0
      for j in ary
        if m == j
          flag = 0
          break
        end
        if m % j == 0
          flag = 1
          break
        end
      end
      new.push(n) if flag == 0
    end
    return new
  end
  def include?(c)
    case c
    when Numeric
      for i in 1..size
        return true if c == clause(i)
      end
      return false
    when Array
      return true if c == subset(c[0],c.size)
      return false
    end
    raise "Bad class type was described."
  end
  def subset(s,n)
    return nil if include?(s) == false
    return nil if include?(clause(index + n - 1)) == false
    return Interval.new(s,clause(index),step).set
  end
end
-------------------------------------------------------------
---
moochan

In This Thread