This function is part of a string of functions (for a course). It is supposed to take a list of reals [s,a,w,h], and check it against other lists of reals for equality. Those lists of reals are made from converting type racer objects (in the list R::acer) to real lists using racer_stats().
I then want the function to return the Racer that has stats that equal its racer_stats() stats. Unfortunately no matter what I try I cant figure out how to get SML to pattern match [s,a,w,h] as a real list so it will not compare, even when I made a new base case.
Any advice?
fun RFS([s,a,w,h], []) = None
| RFS([s,a,w,h], R::acer) =
if ( [s,a,w,h] = racer_stats(R) )
then R
else RFS([s,a,w,h], acer);
I also tried:
fun RFS( [0.1, 0.2, 0.3] , []) = None
| RFS([s,a,w,h], []) = None
| RFS([s,a,w,h], R::acer) =
if ( [s,a,w,h] = racer_stats(R) )
then R
else RFS([s,a,w,h], acer);
and got a syntax error.