[#34722] cgi.rb の form の挙動 — FUJIOKA Takeyuki <fujioka@...>
藤岡です。
18 messages
2002/04/02
[#34754] 続: cgi.rb の form の挙動
— FUJIOKA Takeyuki <fujioka@...>
2002/04/03
藤岡です。
[#34755] Re: 続: cgi.rb の form の挙動
— Wakou Aoyama <wakou@...>
2002/04/03
青山です。
[#34758] Re: 続: cgi.rb の form の挙動
— FUJIOKA Takeyuki <fujioka@...>
2002/04/03
藤岡です。
[#34759] Re: 続: cgi.rb の form の挙動
— Wakou Aoyama <wakou@...>
2002/04/03
青山です。
[#34769] Re: 続: cgi.rb の form の挙動
— FUJIOKA Takeyuki <fujioka@...>
2002/04/04
藤岡です。
[#34724] 「たのしい Ruby 」 — Shin-ichiro HARA <sinara@...>
原(信)です。
18 messages
2002/04/02
[#34728] Re: 「たのしい Ruby 」
— matz@... (Yukihiro Matsumoto)
2002/04/02
まつもと ゆきひろです
[#34746] Re: 「たのしい Ruby 」
— TAKAHASHI Masayoshi <maki@...>
2002/04/02
高橋征義です。
[#34752] Re: 「たのしい Ruby 」
— Shin-ichiro HARA <sinara@...>
2002/04/03
原(信)です。
[#34763] Re: 「たのしい Ruby 」
— TAKAHASHI Masayoshi <maki@...>
2002/04/04
高橋征義です。
[#34730] RubyUnit: I want to test a message of an exception with assert_exception(){}. — NISHIMATSU Takeshi <t-nissie@...>
西松と申します.
7 messages
2002/04/02
[#34732] Re: RubyUnit: I want to test a message of an exception with assert_exception(){}.
— nobu.nakada@...
2002/04/02
なかだです。
[#34735] Re: RubyUnit: I want to test a message of an exception with assert_exception(){}.
— Koji Arai <JCA02266@...>
2002/04/02
新井です。
[#34771] 用語集 super の問題 — Kazuhiro Yoshida <moriq.kazuhiro@...>
もりきゅうです。
7 messages
2002/04/04
[#34820] libplot - Bus Error on Solaris 8 — KATAYAMA Toshiaki <katayama@...>
Solaris 8 の上で ruby-libplot-0.0.5 + plotutils-2.4.1 を使いたいと
4 messages
2002/04/04
[#34835] module_function([name ... ]) — Kazuhiro Yoshida <moriq.kazuhiro@...>
もりきゅうです。
10 messages
2002/04/06
[#34842] [ann] Web 家計簿(β版)リリース — 堀川 久 <vzw00011@...>
こんにちは。
18 messages
2002/04/07
[#34869] Re: [ann] Web 家計簿(β版)リリース
— Nobuhide Kanagawa <nobuhide@...>
2002/04/11
こんばんわ!
[#34870] Re: [ann] Web 家計簿(β版)リリース
— 金光雅夫 (KANEMITSU Masao) <masao-k@...>
2002/04/11
金光です。どもっ。
[#34885] creating a scope / anonymous module — Takaaki Tateishi <ttate@...>
立石です.
38 messages
2002/04/13
[#34888] Re: creating a scope / anonymous module
— Koji Arai <JCA02266@...>
2002/04/13
新井です。
[#34891] Re: creating a scope / anonymous module
— nobu.nakada@...
2002/04/14
なかだです。
[#34892] Re: creating a scope / anonymous module
— Takaaki Tateishi <ttate@...>
2002/04/14
At Sun, 14 Apr 2002 18:00:12 +0900,
[#34894] Re: creating a scope / anonymous module
— nobu.nakada@...
2002/04/14
なかだです。
[#34896] Re: creating a scope / anonymous module
— Takaaki Tateishi <ttate@...>
2002/04/14
At Sun, 14 Apr 2002 21:08:47 +0900,
[#34899] Re: creating a scope / anonymous module
— matz@... (Yukihiro Matsumoto)
2002/04/15
まつもと ゆきひろです
[#34901] Re: creating a scope / anonymous module
— Takaaki Tateishi <ttate@...>
2002/04/15
At Mon, 15 Apr 2002 09:51:05 +0900,
[#34902] Re: creating a scope / anonymous module
— matz@... (Yukihiro Matsumoto)
2002/04/15
まつもと ゆきひろです
[#34903] Re: creating a scope / anonymous module
— Takaaki Tateishi <ttate@...>
2002/04/15
At Mon, 15 Apr 2002 13:53:53 +0900,
[#34904] Re: creating a scope / anonymous module
— matz@... (Yukihiro Matsumoto)
2002/04/15
まつもと ゆきひろです
[#34910] Re: creating a scope / anonymous module
— Takaaki Tateishi <ttate@...>
2002/04/15
At Mon, 15 Apr 2002 15:07:57 +0900,
[#34911] Re: creating a scope / anonymous module
— matz@... (Yukihiro Matsumoto)
2002/04/15
まつもと ゆきひろです
[#34913] Re: creating a scope / anonymous module
— Takaaki Tateishi <ttate@...>
2002/04/15
At Mon, 15 Apr 2002 17:47:00 +0900,
[#34923] Re: creating a scope / anonymous module
— Takaaki Tateishi <ttate@...>
2002/04/16
立石です.
[#34924] Re: creating a scope / anonymous module
— matz@... (Yukihiro Matsumoto)
2002/04/16
まつもと ゆきひろです
[#34897] icc でコンパイルできない — rubikitch <rubikitch@...>
るびきちです。
7 messages
2002/04/14
[#34921] ruby-1.6.7 got SIGILL on Debian/sparc (with patch) — ryu1 <ryu1@...>
はじめまして。
6 messages
2002/04/16
[#34943] Thread by callcc — Shin-ichiro HARA <sinara@...>
原です。
9 messages
2002/04/18
[#34958] windows 版 ruby でシステムコマンドが動かない — "jazzski _comp" <jazzski_comp@...>
はじめてrubyを使うのですが、windows版(cygwin版1.6.1)で下記のように
12 messages
2002/04/23
[ruby-list:34973] Re: Thread by callcc
From:
Shin-ichiro HARA <sinara@...>
Date:
2002-04-24 08:51:30 UTC
List:
ruby-list #34973
原です。
Tanaka Akira writes:
>> なるほど、Thread でもできるとは思っていたのですが、面白いですね。
>> Coroutine は、2つのスレッドでのピンポン方式ですね。
>
>2つというわけではないです。sync-each でいえば引数の数だけスレッドを作
>ります。
引数の数だけのスレッドが、メインスレッドとピンポンしているわけで
すね。メインスレッドを m、他のスレッドを 1, 2, 3 とすると、
[ruby-list:34953] の田中さんの sync-each.rb は([ruby-list:34956]
の sync-each2.rb も)、ほぼ m1m2m3m1m2m3... とスレッドがスイッチ
するのに対して、最初の [ruby-list:34943] の sync-each.rb は、
m123m123... と round robin 式に動くわけで、対比的に前者を「ピンポ
ン」と表現したつもりでした。ちなみに田中さんの sync-each.rb での、
> t = t.resume x
の t = は、不用ですね。私の最初の sync-each.rb の
> a = @ct.pass(a)
の a = はぐるぐる回しにこだわったために必要だったので。
>スレッド間(コルーチン間)の遷移のインターフェースはどうすべきか悩んだん
>ですが、明示的に続きのコルーチンを指定させても行数が増えなかったので、
>記述が繁雑にならないかぎりにおいて低レベルな方が便利、ということで明示
>的に続きを指定させることにしました。
それはそういうことだと思っていました。ただ、CoThread でも1つあ
たり1回しか fork しないなら、コルーチン相当になるので、低レベル
での記述力が落ちているわけではないです。その例が sync-each2.rb
でして。
>CoThread のように暗黙に決まるというのもありだとは思いますが、どんな場
>合に、明示的な指定よりも楽になるでしょう?
あ、わかりました。CoThread という名前が紛らわしい!これは Thread
ではなく、ThreadGroup に近いのかもしれません。
この順番を暗黙に決める方法は Tosh さんのアイデアなんですが、多
分 round robin というのが念頭にあったんだと思います。これがあ
るから、前の CoQueue(あるいは後に添付する CoSizedQueue)が手
軽に書けるのだと思います。また、次のような enumerable オブジェ
クトの「マージ」もシンプルです。
-----^ merge-each.rb
require "co-thread"
class MergeEach
include Enumerable
def initialize(*es)
@ct = CoThread.new
@es = es
end
def each
@es.each do |e|
@ct.fork do
e.each do |x|
yield x
@ct.pass
end
end
end
@ct.exit
end
end
if $0 == __FILE__
class Tosa
def initialize(a, d)
@a, @d = a, d
end
def each
sum = @a
loop do
yield sum
sum += @d
end
end
end
n = 3
ts = (0...n).map{|i| Tosa.new(i, n)}
MergeEach.new(*ts).each do |x|
break if x > 20
p x
end
end
-----$ merge-each.rb
CoQueue を使った MergeEach なら次のようになります。
-----^ merge-each-q.rb
require "co-queue"
class MergeEach
include Enumerable
def initialize(*es)
ct = CoThread.new
@cq = CoQueue.new(ct)
es.each do |e|
ct.fork do
e.each do |x|
@cq.enq(x)
end
end
end
end
def each
loop do
yield(@cq.deq)
end
end
end
-----$ merge-each-q.rb
>まぁ、Thread.critical を使って thread.rb を書くのと、callcc を使って
>co-thread.rb を書くのとどちらが難しいかというと... どっちもどっちじゃ
>ないですかね。
そうかなあ、Thread の方が難しいという印象があるけどなあ。
>> しかし、Thread と Continuation、どちらでも書けるなら前者でなければ
>> ならない、という理由もない気もします。
>
>残念ながら、後者でなければなならない、という理由もないので、ならばどち
>らが適切か、というのが問題ですかねぇ。
それはそうですね。同じものを Thread と Continuation で作ると、
Continuation の方が何倍も遅い、という問題もあるし。
付録:
-----^ co-sized-queue.rb
require "co-thread"
class CoSizedQueue
def initialize(ct, max = 1)
@thread = ct
@max = max
@queue = []
end
def enq(x)
@thread.pass while @queue.size >= @max
@queue.push(x)
@thread.pass
end
def deq
@thread.pass while @queue.empty?
@queue.shift
end
end
if $0 == __FILE__
ct = CoThread.new
qu = CoSizedQueue.new(ct, 2)
ct.fork do
[0, 2, 4].each do |x|
qu.enq(x)
end
end
ct.fork do
[1, 3, 5, 6, 8, 10].each do |x|
qu.enq(x)
end
end
ct.fork do
[7, 9].each do |x|
qu.enq(x)
end
qu.enq :eoi
end
while :eoi != (x = qu.deq)
p x
end
end
-----$ co-sized-queue.rb