OverviewClamps PackagesCM DictionaryClamps DictionaryFomus

fit

Function

(fit number min max [mode])

Forces number to lie between min and max according to mode. If mode is :reflect> (the default), then the min and max boundaries reflect the value back into range. If mode is :wrap then fit returns the remainder of number modulus the boundary range.

Examples

cm> (loop for i from -20 to 20 by 5 collect (fit i 0 10))
(0 5 10 5 0 5 10 5 0)
cm>

See Also