Factor Documentation
|
Home
|
Glossary
|
Search
factorcode.org
clamp ( x min max -- y )
Factor documentation
>
Factor handbook
>
The language
>
Objects
>
Linear order protocol
Prev:
max ( obj1 obj2 -- obj )
Next:
Linear order example
Vocabulary
math.order
Inputs and outputs
x
an
object
min
an
object
max
an
object
y
an
object
Word description
Outputs
x
if contained in the interval
[min,max]
or else outputs one of the endpoints.
Definition
USING:
kernel
;
IN:
math.order
:
clamp
( x min max -- y )
[
max
]
dip
min
;
inline