Project

General

Profile

Actions

Feature #5574

closed

Make arrays comparable

Added by tokland (Arnau Sanchez) about 13 years ago. Updated over 12 years ago.

Status:
Rejected
Target version:
-
[ruby-core:40751]

Description

Why are arrays not comparable? Array already defines <=>, so it seems only natural to mix-in the Comparable module.

> [1, 2] < [1, 1] 
NoMethodError: undefined method `<' for [1, 2]:Array

> Array.send(:include, Comparable)
> [1, 2] < [1, 1] 
=> false

This was already discussed in the mailing list a while ago and people agreed it would be useful:

http://www.ruby-forum.com/topic/76535

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0