bordemstirs
Member
Usually when unexpected errors occur I just bang my head until it goes away.
This time I can't really figure out where I'm going wrong.
Error occurs during the foreach statement in matrixHeight(), but only when called from matrixAddRow();
If I type it manually
it returns 0 as expected.
Relative error:
This time I can't really figure out where I'm going wrong.
Code:
typedef float[int,int] matrix;
typedef float[int] vector;
int matrixHeight(matrix m){
int c=0;
foreach i in m if(i>c)c=i;
return c;
}
matrix matrixAddRow(matrix m,vector v){
int c=m.matrixHeight()+1;
foreach j,f in v m[c,j]=f;
return m.normalize();
}
Error occurs during the foreach statement in matrixHeight(), but only when called from matrixAddRow();
If I type it manually
Code:
> ash import<mathlib.ash> matrix m; m.matrixHeight();
Relative error:
Code:
class java.lang.ClassCastException: net.sourceforge.kolmafia.textui.parsetree.Value cannot be cast to net.sourceforge.kolmafia.textui.parsetree.AggregateValue