On Wed, Dec 7, 2011 at 10:01, Alexey Muranov
<muranov / math.univ-toulouse.fr> wrote:
>
> Issue #5478 has been updated by Alexey Muranov.
>
>
> If you had enough of my comments on this thread, please tell me stop, i will listen.
>
> Here is my another argument in favor of pure Set as a base class or replacement for Hash: on top of Set (or Hash modified in a way to be able to hold pure sets), one can build not only associative arrays, but also a class (call it Relation) that can naturally hold tables from relational databases.A relation, as well as an associative array, is just a form of a set.

From a theoretical point of view, a relation has a heading + a set
that holds tuples (arrays):

  class Relation
    attr_reader :header, :values

    def inittialize(header, values)
      @header = header
      @values = values
    end
  end

  Relation.new(%w[id name], Set[[1, 'Magnus'], [2, 'Alexy']])

Of course, there are many other ways to represent it (depending on
your requirements). Sometimes you want to use a set of hashes. I don't
quite see how the merging of Set and Hash makes it easier to represent
relations though. It's still a two-dimensional data-structure, so you
either need a Set that contains a Hash or a tuple (Set, Array/Hash).