On Friday, I created a new release of Mint and DrJava with Mint: August 20, 2010 (r15700). The latest release is, as always, available from the Mint implementation page:
The only changes that we made were a small change to the build process on Mac OS, and the addition of the Range and Lift utility classes.
The Lift class allows the user to manually lift primitive values and strings when the compiler did not do that already, for example when working with arrays.
The Range class provides methods that allow many for loops to be written as foreach loops with a final loop variable that can be used across bracket boundaries immediately. Consider this example of a staged sparse matrix multiplication:
public static separable
Code
Code
Code
int l, int m, int n) {
Code
for(final int i: range(0, l)) {
for(final int j: range(0, m)) {
Code
for(final int k: range(0, n)) {
if(a[i][k] == 0.0)
continue;
else if(a[i][k] == 1.0)
c = <| `c + (`b)[k][j] |>;
else
c = <| `c + (`(lift(a[i][k])) * (`b)[k][j]) |>;
}
stats = <| { `stats; (`output)[i][j] = `c; } |>;
}
}
return stats;
}
is a lot cleaner than
public static separable
Code
Code
Code
int l, int m, int n) {
Code
for(int i = 0; i < l; i++) {
for(int j = 0; j < m; j++) {
final int ii = i;
final int jj = j;
Code
for(int k = 0; k < n; k++) {
final int kk = k;
if(a[i][k] == 0.0)
continue;
else if(a[i][k] == 1.0)
c = <| `c + (`b)[kk][jj] |>;
else
c = <| `c + (`(lift(a[ii][kk])) * (`b)[kk][jj]) |>;
}
stats = <| { `stats; (`output)[ii][jj] = `c; } |>;
}
}
return stats;
}
The ii, jj, and kk variables aren’t necessary anymore.
(Re-posted from The Java Mint Blog.)