JanetDocsSourcePlaygroundTutorialsI'm Feeling luckyCommunityGitHub sign in

array/new

core-api


    cfunction
    src/core/array.c on line 136, column 1

    (array/new capacity)

    Creates a new empty array with a pre-allocated capacity. The same 
    as `(array)` but can be more efficient if the maximum size of an 
    array is known.


1 exampleSign in to add an example
Loading...
(let (sinlu (array/new 10))  # 10 element look up table.
  (for i 0 10 (put sinlu i (math/sin (* math/pi (/ i 10)))))
  (pp sinlu))
oofoePlayground