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」,但爲什麼它有幫助?