Skip to main content

multi sequence, and functions with multi arguments

1 reply [Last post]
porfirioribeiro
Offline
Joined: 2006-08-18
Points: 0

Is there a way to work with multi dimension sequencies as we do for arrays?
Like:

function doit(ints:Integer[][]){
for (a in ints){
for (b in a){
//do something
}
}
}

And array parameters functions

function doit2(ints:Integer[]...){
for (a in ints){
for (b in a){
//do something
}
}
}

var ints:Integer[][]=[[0,0],[0,1]];

doit(ints);
doit2([0,0],[0,1]);

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
alexsch
Offline
Joined: 2007-07-12
Points: 0

> Is there a way to work with multi dimension
> sequencies as we do for arrays?

No, there is not. See http://openjfx.java.sun.com/current-build/doc/reference/orig/sequences.html

You can use Java classes to work with arrays or work with matrix like this:

[code]

var projection = Matrix{
dimN: 2
dimM: 4
elems: [
[1, 0, 0, 0],
[0, 1, 0, 0]
]
};

public class Matrix {

public var dimN:Integer;
public var dimM:Integer;

public var elems:Number[] ;

public function getElem (n:Integer, m: Integer):Number {
return elems[dimM * n + m ];
}

}
[/code]