list normalize - part-cw/lambdanative GitHub Wiki
(list-normalize lst)
list-normalize normalizes a list. This assigns the smallest element to 0, the largest element to 1 and scales the others accordingly.
Parameter | Description |
---|---|
lst | List to operate on |
Example
Example 1: Normalize a list of values from 1-9 to a range of 0-1
> (define lst '(1 2 3 4 5 6 7 8 9))
> (list-normalize lst)
(0 1/8 1/4 3/8 1/2 5/8 3/4 7/8 1)