[#16732] sharing sub-regexp — Tanaka Akira <akr@...17n.org>

Oniguruma についてひとつ要望があります。

51 messages 2002/04/03
[#16744] Re: sharing sub-regexp — "K.Kosako" <kosako@...> 2002/04/04

Tanaka Akiraさんの<hvopu1hxfyd.fsf@coulee.a02.aist.go.jp>から

[#16746] Re: sharing sub-regexp — matz@... (Yukihiro Matsumoto) 2002/04/04

まつもと ゆきひろです

[#16753] Re: sharing sub-regexp — Tanaka Akira <akr@...17n.org> 2002/04/04

In article <1017890618.302241.17865.nullmailer@ev.netlab.jp>,

[#16755] Re: sharing sub-regexp — "K.Kosako" <kosako@...> 2002/04/05

Tanaka Akiraさんの<hvo7knn93ug.fsf@coulee.a02.aist.go.jp>から

[#16756] Re: sharing sub-regexp — Tanaka Akira <akr@...17n.org> 2002/04/05

In article <20020405044506.D4784349@helium.ruby-lang.org>,

[#16822] Re: sharing sub-regexp — "K.Kosako" <kosako@...> 2002/04/10

Tanaka Akiraさんの<hvopu1e4omy.fsf@coulee.a02.aist.go.jp>から

[#16831] Re: sharing sub-regexp — Tanaka Akira <akr@...17n.org> 2002/04/10

In article <20020410025054.C8DF0915@helium.ruby-lang.org>,

[#16863] Re: sharing sub-regexp — Tanaka Akira <akr@...17n.org> 2002/04/11

In article <hvor8lnchak.fsf@coulee.a02.aist.go.jp>,

[#16877] Re: sharing sub-regexp — Shugo Maeda <shugo@...> 2002/04/12

前田です。

[#16887] Re: sharing sub-regexp — Tanaka Akira <akr@...17n.org> 2002/04/12

In article <87pu15z80q.wl@studly.priv.netlab.jp>,

[#16909] Regexp#to_s — Shugo Maeda <shugo@...> 2002/04/15

前田です。

[#16912] Re: Regexp#to_s — Tanaka Akira <akr@...17n.org> 2002/04/15

In article <87g01x1e6m.wl@studly.priv.netlab.jp>,

[#16931] Re: Regexp#to_s — Kazuhiro NISHIYAMA <zn@...> 2002/04/16

西山和広です。

[#16934] Re: Regexp#to_s — Tanaka Akira <akr@...17n.org> 2002/04/16

In article <20020416180631.988E.ZN@mbf.nifty.com>,

[#16938] Re: Regexp#to_s — Shugo Maeda <shugo@...> 2002/04/17

前田です。

[#16939] Re: Regexp#to_s — Tanaka Akira <akr@...17n.org> 2002/04/17

In article <87u1qaj0xe.wl@studly.priv.netlab.jp>,

[#16947] Re: Regexp#to_s — Shugo Maeda <shugo@...> 2002/04/18

前田です。

[#16950] Re: Regexp#to_s — matz@... (Yukihiro Matsumoto) 2002/04/18

まつもと ゆきひろです

[#16951] Re: Regexp#to_s — Tanaka Akira <akr@...17n.org> 2002/04/18

In article <1019116103.420173.12691.nullmailer@picachu.netlab.jp>,

[#16960] Re: Regexp#to_s — nobu.nakada@... 2002/04/18

なかだです。

[#16761] StringIO — tadf@...

ふなばです。

43 messages 2002/04/05
[#16786] Re: StringIO — nobu.nakada@... 2002/04/08

なかだです。

[#16802] Re: StringIO — tadf@... 2002/04/09

ふなばです。

[#16803] Re: StringIO — nobu.nakada@... 2002/04/09

なかだです。

[#16804] Re: StringIO — tadf@... 2002/04/09

ふなばです。

[#17221] Re: StringIO — Wakou Aoyama <wakou@...> 2002/05/30

青山です。

[#17230] Re: StringIO — matz@... (Yukihiro Matsumoto) 2002/05/30

まつもと ゆきひろです

[#17231] Re: StringIO — Tanaka Akira <akr@...17n.org> 2002/05/30

In article <1022740594.117106.6073.nullmailer@picachu.netlab.jp>,

[#17233] IO#size — Shugo Maeda <shugo@...> 2002/05/30

前田です。

[#17239] Re: IO#size — Tanaka Akira <akr@...17n.org> 2002/05/31

In article <874rgqdt3x.wl@studly.priv.netlab.jp>,

[#17253] Re: IO#size — Wakou Aoyama <wakou@...> 2002/05/31

青山です。

[#16790] Ruby Shim — "Akinori MUSHA" <knu@...>

 1.7 early access kit という仮称で提案した構想ですが、先ほど

27 messages 2002/04/08
[#16796] Re: Ruby Shim — Koji Arai <JCA02266@...> 2002/04/08

新井です。

[#16833] math.c 1.10 — "U.Nakamura" <usa@...>

こんにちは、なかむら(う)です。

23 messages 2002/04/11
[#16834] Re: math.c 1.10 — matz@... (Yukihiro Matsumoto) 2002/04/11

まつもと ゆきひろです

[#16869] Makefiles dependency — nobu.nakada@...

なかだです。

17 messages 2002/04/12

[ruby-dev:16797] Re: Ruby Shim

From: nobu.nakada@...
Date: 2002-04-08 17:14:19 UTC
List: ruby-dev #16797
なかだです。

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はできる。
    中田 伸悦

In This Thread