From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: poffice@blade.nagaokaut.ac.jp Delivered-To: poffice@blade.nagaokaut.ac.jp Received: from kankan.nagaokaut.ac.jp (kankan.nagaokaut.ac.jp [133.44.2.24]) by blade.nagaokaut.ac.jp (Postfix) with ESMTP id 285BA1A80046 for ; Thu, 21 Jul 2016 21:37:42 +0900 (JST) Received: from voscc.nagaokaut.ac.jp (voscc.nagaokaut.ac.jp [133.44.1.100]) by kankan.nagaokaut.ac.jp (Postfix) with ESMTP id 7278EB5D945 for ; Thu, 21 Jul 2016 22:11:42 +0900 (JST) Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by voscc.nagaokaut.ac.jp (Postfix) with ESMTP id 29A9E18CC88B for ; Thu, 21 Jul 2016 22:11:43 +0900 (JST) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 5133E120436; Thu, 21 Jul 2016 22:11:42 +0900 (JST) X-Original-To: ruby-core@ruby-lang.org Delivered-To: ruby-core@ruby-lang.org Received: from o2.heroku.sendgrid.net (o2.heroku.sendgrid.net [67.228.50.55]) by neon.ruby-lang.org (Postfix) with ESMTPS id 7B316120400 for ; Thu, 21 Jul 2016 22:11:38 +0900 (JST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sendgrid.me; h=from:to:references:subject:mime-version:content-type:content-transfer-encoding:list-id; s=smtpapi; bh=PvEjnRp88EunSLgGSzjSUz2bf2k=; b=ESw8qwliXOojM5i29F K4Ta8fMTEZ7BTS/5kFdaBTISh4SHSAfL6C/7DPU2FIRju0DDLi1a08EbX7txab1g hoHZWTsyYHr+4dDJfxKXQ663D1CyDIrrQD+VJoOoz3RZSJ+zl1unyaftHw50/+Sy GFCFrJ0/BHeGdHNslvUdEBeYc= Received: by filter0433p1mdw1.sendgrid.net with SMTP id filter0433p1mdw1.30034.5790C9D367 2016-07-21 13:10:43.681545016 +0000 UTC Received: from herokuapp.com (ec2-54-161-2-13.compute-1.amazonaws.com [54.161.2.13]) by ismtpd0004p1iad1.sendgrid.net (SG) with ESMTP id BFNhQXCuQxuPZ5nHLrHfqA Thu, 21 Jul 2016 13:10:43.549 +0000 (UTC) Date: Thu, 21 Jul 2016 13:10:43 +0000 From: nerdinand@nerdinand.com To: ruby-core@ruby-lang.org Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 51269 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 10594 X-Redmine-Issue-Author: findchris X-Redmine-Sender: nerdinand X-Mailer: Redmine X-Redmine-Host: bugs.ruby-lang.org X-Redmine-Site: Ruby Issue Tracking System X-Auto-Response-Suppress: All Auto-Submitted: auto-generated X-SG-EID: ync6xU2WACa70kv/Ymy4QrNMhiuLXJG8OTL2vJD1yS73xZTsnnVcqGIsVVYS1eFfVJAsWMyIWMvN3/ m7c4vWzizS1n8TgyBRJfNUf9486Go//llffIAS4bcgIN/aPftfngY9jDeolIWaUwL3Ifx99zDBe51/ w1BpWcmyo1Fpb6YovsQhrGfwARJwJ3TFOF7mgPAHF6LkhrL6c+SyX1DKUQ== X-ML-Name: ruby-core X-Mail-Count: 76503 Subject: [ruby-core:76503] [Ruby trunk Feature#10594] Comparable#clamp X-BeenThere: ruby-core@ruby-lang.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Ruby developers List-Id: Ruby developers List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ruby-core-bounces@ruby-lang.org Sender: "ruby-core" 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/