如何声明一个函数,使Listn:''列表 - > ''列表 - > bool,listn xs和ys返回true。
示例:lisen [#“1”#“2”],[#“1”“#3”]返回false和[#“1”,#“2”] [#“2”,#“1 “]返回true
答案 0 :(得分:0)
试试这个:
infix member
fun x member [] = false
| x member (y::ys) = x = y orelse x member ys;
fun listn (x::xs) ys = x member ys andalso listn xs ys
| listn [] _ = true;