Can I specify a dynamic matrix?

 
 
 

You can’t specify the size of a matrix with a variable. Also, there is no command which will clear a matrix and free up the memory it uses.

How do I simulate variable length argument lists?

At the procedure definition site, declare your argument as an array of whatever data type you need.

At the call site, use an array variable of the same type. Alternatively, you can use the array expression notation to create a array without having to declare a variable and do all of the assignments into it.

For example:

proc foo ( float $f[], string $s[]) {
 print("size of f=" + size($f) + "\n");
 for ( $i=0; $i < size($f); ++$i ) {
 print("f[" + $i + "]=" + $f[$i] + "\n");
 }
 print("size of s=" + size($s) + "\n");
 for ( $i=0; $i < size($s); ++$i ) {
 print("s[" + $i + "]=" + $s[$i] + "\n");
 }
 }
 float $ff[2]={0.9, 1.2};
 float $gg[];
 for ( $i=0; $i < 10; ++$i ) {
 $gg[$i] = $i;
 }
 foo $ff {}; // passes the array "$ff" and the empty array to foo.
 foo $gg {"hello", "world"}; // passes the array "$gg" and an array of 2 strings
 // to foo.
 foo {} {}; // calls foo with 2 empty arrays.

Array expressions get their base type from the type of the first element in the list. So, to force your array expression to be of a certain type, you can cast the first element:

foo {(float)1, 2, 3} {"hello"};
// make first array an array of float, not int.