[ruby-core:114855] [Ruby master Feature#13933] Add Range#empty?

21 Sep
2023
21 Sep
'23
1:57 a.m.
Issue #13933 has been updated by Dan0042 (Daniel DeLorme). It was an ad-hoc example that just seemed to me like it should return true. As to how to define it... maybe we can say that numeric ranges are equivalent to `begin == -Float::INFINITY` if beginless, and `end == +Float::INFINITY` if endless. Then it would be like saying `(k...k).empty?` with `k == -Float::INFINITY` ---------------------------------------- Feature #13933: Add Range#empty? https://bugs.ruby-lang.org/issues/13933#change-104702 * Author: ted (Ted Johansson) * Status: Open * Priority: Normal ---------------------------------------- Range already responds to #size. It would be nice if it also responded to predicate #empty? :-) -- https://bugs.ruby-lang.org/
683
Age (days ago)
683
Last active (days ago)
0 comments
1 participants
participants (1)
-
Dan0042 (Daniel DeLorme)