[#16708] includedir — nobu.nakada@...
なかだです。
[#16732] sharing sub-regexp — Tanaka Akira <akr@...17n.org>
Oniguruma についてひとつ要望があります。
Tanaka Akiraさんの<hvopu1hxfyd.fsf@coulee.a02.aist.go.jp>から
まつもと ゆきひろです
In article <1017890618.302241.17865.nullmailer@ev.netlab.jp>,
Tanaka Akiraさんの<hvo7knn93ug.fsf@coulee.a02.aist.go.jp>から
In article <20020405044506.D4784349@helium.ruby-lang.org>,
Tanaka Akiraさんの<hvopu1e4omy.fsf@coulee.a02.aist.go.jp>から
In article <20020410025054.C8DF0915@helium.ruby-lang.org>,
In article <hvor8lnchak.fsf@coulee.a02.aist.go.jp>,
前田です。
In article <87pu15z80q.wl@studly.priv.netlab.jp>,
前田です。
In article <87g01x1e6m.wl@studly.priv.netlab.jp>,
西山和広です。
In article <20020416180631.988E.ZN@mbf.nifty.com>,
前田です。
In article <87u1qaj0xe.wl@studly.priv.netlab.jp>,
前田です。
まつもと ゆきひろです
In article <1019116103.420173.12691.nullmailer@picachu.netlab.jp>,
前田です。
なかだです。
In article <200204181023.g3IANgM21124@sharui.nakada.kanuma.tochigi.jp>,
まつもと ゆきひろです
In article <1019140164.869863.14833.nullmailer@picachu.netlab.jp>,
[#16757] === — "Akinori MUSHA" <knu@...>
Array, Hash, Proc などで、 === が以下のように定義されていると
[#16761] StringIO — tadf@...
ふなばです。
なかだです。
ふなばです。
なかだです。
ふなばです。
青山です。
まつもと ゆきひろです
In article <1022740594.117106.6073.nullmailer@picachu.netlab.jp>,
前田です。
In article <874rgqdt3x.wl@studly.priv.netlab.jp>,
青山です。
まつもと ゆきひろです
青山です。
まつもと ゆきひろです
青山です。
まつもと ゆきひろです
青山です。
[#16776] Ruby 1.7.2 segfault — takuma ozawa <metal@...>
小澤といいます。
なかだです。
[#16790] Ruby Shim — "Akinori MUSHA" <knu@...>
1.7 early access kit という仮称で提案した構想ですが、先ほど
新井です。
At Tue, 9 Apr 2002 02:12:27 +0900,
なかだです。
[#16816] remove_const: cannot remove constant — Koji Arai <JCA02266@...>
新井です。
[#16833] math.c 1.10 — "U.Nakamura" <usa@...>
こんにちは、なかむら(う)です。
まつもと ゆきひろです
さくです。
なかだです。
まつもと ゆきひろです
[#16868] make error on debian potato — Wakou Aoyama <wakou@...>
青山です。
[#16869] Makefiles dependency — nobu.nakada@...
なかだです。
わたなべです。
なかだです。
わたなべです。
なかだです。
わたなべです。
なかだです。
[#16894] compile failure in process.c, setpgrp() & setpgid() — Ryo HAYASAKA <ryoh@...>
早坂@北陸先端です.
[#16923] Module::new with block is useful? — "Shin'ya Adzumi" <adzumi@...>
あづみです。
[#16978] Re: [rubyist:1343] Re: another sample for the Method — Koji Arai <JCA02266@...>
新井です。
[#16989] making Proc in C (Re: [rubyist:1356] Re: another sample for the Method) — nobu.nakada@...
なかだです。
[ruby-dev:16797] Re: Ruby Shim
なかだです。
At Mon, 8 Apr 2002 23:17:05 +0900,
Akinori MUSHA wrote:
> 今のところ、サンプルとして Dir::chdir() の拡張だけ入れてあります。
> 徐々に充実させていきましょう。
ファイルはフィーチャー単位じゃなくてクラス/モジュール単位? とり
あえずEnumerableなぞを。
Index: ruby16/Makefile
===================================================================
RCS file: /cvs/ruby/src/shim/ruby16/Makefile,v
retrieving revision 1.1.1.1
diff -u -2 -p -r1.1.1.1 Makefile
--- ruby16/Makefile 2002/04/08 13:09:31 1.1.1.1
+++ ruby16/Makefile 2002/04/08 17:11:26
@@ -51,3 +51,3 @@ show:
test: $(SETUP_COOKIE)
- @cd tests; $(RUBY) -I. -I../lib test.rb
+ @$(RUBY) -Ctests -I. -I../lib test.rb
Index: ruby16/lib/features/ruby18/enumerable.rb
===================================================================
RCS file: enumerable.rb
diff -N enumerable.rb
--- /dev/null Thu Jan 1 09:00:00 1970
+++ enumerable.rb Tue Apr 9 02:10:47 2002
@@ -0,0 +1,33 @@
+# $Id$
+
+RUBY_VERSION >= '1.7' and raise LoadError, "This module is only for ruby 1.6.x."
+
+module Enumerable
+ def all?
+ each {|arg| return false unless yield(arg)}
+ true
+ end
+
+ def any?
+ each {|arg| return true if yield(arg)}
+ false
+ end
+
+ def inject(result = needinit = true)
+ i = nil
+ each do |i|
+ if needinit
+ needinit = false
+ result = i
+ else
+ result = yield(result, i)
+ end
+ end
+ result
+ end
+
+ def sort_by
+ e = i = v = 0
+ collect {|e| [yield(e), (i += 1), e]}.sort.collect {|v, i, e| e}
+ end
+end
Index: ruby16/tests/features/tc_ruby18.rb
===================================================================
RCS file: /cvs/ruby/src/shim/ruby16/tests/features/tc_ruby18.rb,v
retrieving revision 1.1.1.1
diff -u -2 -p -r1.1.1.1 tc_ruby18.rb
--- ruby16/tests/features/tc_ruby18.rb 2002/04/08 13:09:31 1.1.1.1
+++ ruby16/tests/features/tc_ruby18.rb 2002/04/08 16:39:13
@@ -3,2 +3,3 @@
require 'test/unit'
require 'features/ruby18/tc_dir'
+require 'features/ruby18/tc_enumerable'
Index: ruby16/tests/features/ruby18/tc_enumerable.rb
===================================================================
RCS file: tc_enumerable.rb
diff -N tc_enumerable.rb
--- /dev/null Thu Jan 1 09:00:00 1970
+++ tc_enumerable.rb Tue Apr 9 02:10:22 2002
@@ -0,0 +1,33 @@
+# $Id$
+
+require 'test/unit'
+begin
+ require 'features/ruby18/enumerable'
+rescue LoadError; end
+
+class TC_Enumerable < Test::Unit::TestCase
+ def test_all?
+ assert_equal(true, [0, 2, 4, 6].all? {|i| i % 2 == 0})
+ assert_equal(false, [0, 2, 4, 7].all? {|i| i % 2 == 0})
+ assert_equal(true, ["", [], {}].all? {|i| i.empty?})
+ assert_equal(false, ["", [], {}, "a"].all? {|i| i % 2 == 0})
+ end
+
+ def test_any?
+ assert_equal(true, [0, 2, 4, 7].any? {|i| i % 2 != 0})
+ assert_equal(false, [0, 2, 4, 6].any? {|i| i % 2 != 0})
+ assert_equal(false, ["", [], {}].any? {|i| !i.empty?})
+ assert_equal(true, ["", [], {}, "a"].any? {|i| !i.empty?})
+ end
+
+ def test_sort_by
+ ary = ["BAR", "FOO", "bar", "foo"]
+ assert_equal(ary.sort {|a,b| a.downcase <=> b.downcase }, ary.sort_by {|a| a.downcase})
+ end
+
+ def test_inject
+ a = (1..4)
+ assert_equal(11, a.inject(1) {|x,y| x+y})
+ assert_equal(10, a.inject {|x,y| x+y})
+ end
+end
--
--- 僕の前にBugはない。
--- 僕の後ろにBugはできる。
中田 伸悦