0
我在做课程作业。任何人都可以解释为什么此代码的工作原理:sml模式看不到绑定变量
fun remove_card(cs: card list, c: card, except:exn)=
case cs of []=>raise except
| x::xs =>(case (x=c) of true=> xs
| _ => x::remove_card(xs,c,except))
但这里它说“模式冗余”好像c是未定义的?
fun remove_card(cs: card list, c: card, except:exn)=
case cs of []=>raise except
| x::xs =>(case x of c=> xs
| _ => x::remove_card(xs,c,except))
?
另一件有用的事情是在函数声明中改为“cs as x :: xs”,但为什么它有帮助?