Specialized array examples - Factor Documentation (original) (raw)
Let's import specialized float arrays:
USING: specialized-arrays math.constants math.functions ; SPECIALIZED-ARRAY: float
Creating a float array with 3 elements:
1.0 [ sin ] [ cos ] [ tan ] tri float-array{ } 3sequence .
Create a float array and sum the elements:
1000 [ 1000 /f pi * sin ] float-array{ } map-as 0.0 [ + ] reduce .