Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/list/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/haskell/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/fsharp/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
List Haskell show是否应基于其他列表排除该列表?_List_Haskell - Fatal编程技术网

List Haskell show是否应基于其他列表排除该列表?

List Haskell show是否应基于其他列表排除该列表?,list,haskell,List,Haskell,我有两份清单;一个是我想从另一个列表中排除的列表, 就像这个 a::[String] a = [["A1","B2","C5"],["A3","B1","C2"]] 我还有一个列表,我想排除包含a b :: [[String]] b = [["A1","B1","H5"],["A3","C2","B1"],["A1","B2","H5"],["H2","H3","B2"],["H5","B1","H4"]] 预期结果将是: [["H5","B1","H4"]] 我的做法如下: exclu

我有两份清单;一个是我想从另一个列表中排除的列表, 就像这个

a::[String]
a = [["A1","B2","C5"],["A3","B1","C2"]]
我还有一个列表,我想排除包含
a

b :: [[String]] 
b = [["A1","B1","H5"],["A3","C2","B1"],["A1","B2","H5"],["H2","H3","B2"],["H5","B1","H4"]]
预期结果将是:

[["H5","B1","H4"]]
我的做法如下:

excludeList ::[[String]]-> [[String]] -> [[String]]
excludeList a b = filter (any (`elem` b)) a
我知道上面的代码将保留包含
list1
中任何元素的元素,但我不知道如何使用
而不是
?但无论我放在哪里,我的IDE总是给我一个错误。我怎样才能修好它?而且似乎
elem
无法处理
[[String]]
类型,我该怎么办?
非常感谢

您使用
而不是
是正确的,但是您可能会错误地使用它
not
应用于组合传递给
过滤器的现有函数:

filter (not . (any (`elem` b))) a
或者通过使用德摩根定律

filter (all (`notElem` b)) a

您应该包括导致错误的代码和错误本身。您在文本中提到
list1
,但不在代码中提及。请更正打字错误。