SML:非构造函数应用于模式@中的参数
SML: non-constructor applied to argument in pattern @
为什么我不能执行以下操作,有什么方法可以执行?
datatype boolexp = zero
| one
| compl of boolexp;
fun convert (#"1"::nil) = one
| convert (#"0"::nil) = zero
| convert (#"-":: #"(" :: xs @ [#")"]) = compl (convert xs)
它给我错误:
non-constructor applied to argument in pattern: @
unbound variable or constructor: xs
为什么我不能执行以下操作,有什么方法可以执行?
datatype boolexp = zero
| one
| compl of boolexp;
fun convert (#"1"::nil) = one
| convert (#"0"::nil) = zero
| convert (#"-":: #"(" :: xs @ [#")"]) = compl (convert xs)
它给我错误:
non-constructor applied to argument in pattern: @
unbound variable or constructor: xs