错误:删除ID RPAREN;;;时出现语法错误;;;;SML

错误:删除ID RPAREN;;;时出现语法错误;;;;SML,sml,ml,Sml,Ml,我试图编写一个函数,将一个地雷插入到一个2dm矩阵中,它位于地雷(坐标)列表中,我从用户那里收到。 n表示尺寸。 我得到了标题中的错误 请帮忙。(rowCounter+1,0,retGame@(隐藏在我的后面))有不平衡的括号。类似于(rowCounter+1,0,retGame@(隐藏在空白中))。不过,除此之外,以这种方式使用的几乎没有意义。您没有定义数据类型。SML知道什么是隐藏的,你不需要提醒它。你确实需要确保@在那里是有意义的。顺便说一下,你需要的不是隐藏的我的而是隐藏的我的。但是,由

我试图编写一个函数,将一个地雷插入到一个2dm矩阵中,它位于地雷(坐标)列表中,我从用户那里收到。 n表示尺寸。 我得到了标题中的错误

请帮忙。

(rowCounter+1,0,retGame@(隐藏在我的后面))
有不平衡的括号。类似于
(rowCounter+1,0,retGame@(隐藏在空白中))
。不过,除此之外,以这种方式使用的几乎没有意义。您没有定义数据类型。SML知道什么是隐藏的,你不需要提醒它。你确实需要确保
@
在那里是有意义的。顺便说一下,你需要的不是
隐藏的我的
而是
隐藏的我的
。但是,由于这将是一个
正方形
,而不是“正方形列表
”,因此使用
@`将失败。
datatype SquareContent = Mine | Digit of int | Blank;
datatype Square = Revealed of SquareContent | Concealed of SquareContent;
datatype GameStatus = OnGoing | Success | Failure; 
type MineSweeperState = (Square list list * GameStatus);
type matrix = Square list list;

fun createMineSweeperGrid (n:int, mines:(int*int) list)
:(Square list list)= 
let
   fun createMines (rowCounter:int, colCounter:int
    , retGame:Square list list):(Square list list) = 
    if rowCounter=n then   
      retGame         (* finished all rows, should be n lists of size n*)
    else
      if colCounter=n then   (*finished current row, move on*)
        createMines (rowCounter+1, 0, retGame)
     else   
        if (List.exists(fn y => (rowCounter,colCounter) = y) mines) then
           createMines (rowCounter+1, 0, retGame@(Concealed of Mine)))
        else
           createMines (rowCounter+1, 0, retGame@(Concealed of Blank)))
in
  createMines (0,0,[])
end