While exploring nim, I came to know that you cannot create an array during dynamically. The size of the array must be known at compile time. There are a few work around as i have found in the previous thread i ask or one can use static[int] while using array within a function or object. Why was the array designed this way in nim? Most major static language can create dynamically. Is seq the answer to this problem? I am assuming seq is like a Array in java or vector in c++ where the memory doubles after hitting a certain threshold. What is the performance difference between array and seq?
One more question ... How do i pass a matrix to function?
proc (mat: var openArray[seq[int]]) = discard
This is working for a 2d seq, but if the rank increases it will be quite cumbersome. Is there a more elegant way to pass matrix to a function?seq is what you are looking for.
Check Arraymancer package for matrix/tensor (?).
Resizable arrays are either called sequences or vectors in static languages.
There is no performance difference for indexing with []. Allocating a new seq is more costly, and the add to append to a seq has no equivalent for an array.