libmultiset.rb

Path: multiset/libmultiset.rb
Last Update: Tue Mar 25 02:18:36 +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>

Required files

set  

[Validate]