Specialized array examples
Factor handbook » The language » Collections » Specialized arrays

Prev:Vector arithmetic with specialized arrays


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 <iota> [ 1000 /f pi * sin ] float-array{ } map-as 0.0 [ + ] reduce .