fun compare(nil,nil) = EQUAL | compare(nil,_) = LESS | compare(_,nil) = GREATER | compare(x::xs,y::ys) = if xy then GREATER else compare(xs,ys);