It looks like a bug in the code-generator and will depend on exactly what the code is. I'll have a closer look.
David
On 12/09/2018 14:17, Mark Clements wrote:
Does anyone know why the following will not compile? I am using Poly/ML 5.7.1 Release (Git version v5.7.1-88-g04ba183) on Ubuntu 16.04LTS.
fun invDet2(M) = let val a = Array2.sub(M,0,0) val b = Array2.sub(M,0,1) val c = Array2.sub(M,1,0) val d = Array2.sub(M,1,1) val det = (a*d - b*c) val x = 1.0/det val inv = Array2.fromList [[d*x, ~b*x], [~c*x, a*x]] in (inv,det) end;
(* see http://www.cs.cmu.edu/afs/cs/project/pscico/pscico/src/matrix/RealMatrix.sml *)
Note that the following is okay:
fun invDet2(M) = let val a = Array2.sub(M,0,0) val b = Array2.sub(M,0,1) val c = Array2.sub(M,1,0) val d = Array2.sub(M,1,1) val det = (a*d - b*c) val inv = Array2.fromList [[d/det, ~b/det], [~c/det, a/det]] in (inv,det) end;
--- Mark
polyml mailing list polyml at inf.ed.ac.uk http://lists.inf.ed.ac.uk/mailman/listinfo/polyml