HF RL Explorer

Task: Implement an Efficient Number Clipping Function

Task: Implement an Efficient Number Clipping Function: a task in Terminal-Lego-15k (Harbor dataset). Implement an efficient and elegant function to clip (clamp) a number to be within a specified range. Given a real number n , a minimum value lower , and a maximum value upper , the function should…

The task

Implement an efficient and elegant function to clip (clamp) a number to be within a specified range. Given a real number `n`, a minimum value `lower`, and a maximum value `upper`, the function should return: - `lower` if `n < lower` - `upper` if `n > upper` - `n` otherwise (when `lower <= n <= upper`)

Part of PrimeIntellect/Terminal-Lego-15k.