[ruby-core:76503] [Ruby trunk Feature#10594] Comparable#clamp

From: nerdinand@...
Date: 2016-07-21 13:10:43 UTC
List: ruby-core #76503
Issue #10594 has been updated by Ferdinand Niedermann.


Anyone there? I'd love to see this in Ruby finally and I'm not the only one...

----------------------------------------
Feature #10594: Comparable#clamp
https://bugs.ruby-lang.org/issues/10594#change-59746

* Author: Chris Johnson
* Status: Open
* Priority: Normal
* Assignee: 
----------------------------------------
This is basically a re-opening of the feature request of issue#4573 (https://bugs.ruby-lang.org/issues/4574), which was closed due a naming debate.

It seems the standard naming for restricting a number to a specified range is indeed 'clamp'.  (1)(2)(3)

As such, can we use Yusuke Endoh's original patch with the naming adjustments?  If so, I can provide accordingly.

Cheers.

(1) http://www.rubydoc.info/github/epitron/epitools/Numeric:clamp
(2) http://stackoverflow.com/questions/12020787/is-there-a-limit-clamp-function-in-ruby
(3) https://developer.gnome.org/glib/stable/glib-Standard-Macros.html#CLAMP:CAPS


---Files--------------------------------
num_clamp.c (427 Bytes)
comparable-clamp.diff (2.52 KB)


-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread

Prev Next