multiset.rb

Path: multiset/multiset.rb
Last Update: Sat Feb 16 21:16:44 +0900 2008

概要(Basic information)

Rubyによる多重集合(マルチセット)の実装です。 通常の集合(Rubyでは"set"ライブラリ)と異なり、多重集合は 同一の要素を複数格納することができます。

メソッド名は基本的にSetクラスに合わせてあります。またSetクラスが持つ メソッドの大部分を実装していますが、いくつか未実装なものもあります。

Ruby implementation of multiset. Unlike ordinary set(see Ruby documentation for "set" library), multiset can contain two or more same items.

Most methods’ names are same as those of Set class, and all other than a few methods in Set class is implemented on Multiset class.

  • Set[:a,:b,:c,:b,:b,:c] => #<Set: {:b, :c, :a}>
  • Multiset[:a,:b,:c,:b,:b,:c] => #<Multiset:#3 :b, #2 :c, #1 :a>

インストール(Installation)

申し訳ありませんが、特にインストール手段は設けておりません。

このプログラムはmultiset.rb単独で動作するので、多重集合を使いたいプログラムと 同じディレクトリに入れるなり、lib/rubyディレクトリにコピーするなりして下さい。

I am sorry that I have not prepare anything for installation.

multiset.rb works by itself, without any file. Put multiset.rb in the same directory your program resides, or put in lib/ruby directory.

更新履歴(Revision history)

  • Version 0.10(2008/2/9)
    • 公開開始。
  • Version 0.11(2008/2/12)
    • メソッド「&」の実装が誤っていたのを修正。
    • ドキュメントの間違いを修正。
  • Version 0.12(2008/2/16)
    • Hash#to_multisetに冗長な処理があったので修正。
    • Multisetにメソッドmap, map!, collect, collect!, map_with, map_with!を追加。
      • これに伴い、従来のMultiset#mapなどとは挙動が変更されました。 (従来のMultiset#mapなどはEnumerable#mapを呼んでいたので、 返り値は配列でした。)

  • Version 0.10(2008/2/9)
    • First distribution.
  • Version 0.11(2008/2/12)
    • Fixed wrong implementation of method "&".
    • Fixed wrong documentation.
  • Version 0.12(2008/2/16)

著作権表示(Copyright)

Author:Maraigue(f52.aaa.livedoor.jp/~maraigue/)
Version:0.11(2008/2/12)
Copyright:(C)2008 Maraigue

このプログラムはBSDライセンスにて提供する 無 保 証 のプログラムです。 詳細はBSDLicense.txtをご覧下さい。

日本語の参考訳は以下のURLにあります。 sourceforge.jp/projects/opensource/wiki/licenses%2Fnew_BSD_license ただし、法的にはBSDLicense.txtに書かれた英語の文章のみが有効です。

This program is districuted with ABSOLUTELY NO WARRANTY, under BSD License. See BSDLicense.txt for more detail.

Required files

set  

[Validate]