Haskell中的模式匹配错误
我正在编写一个函数,它将布尔列表映射成布尔列表。这是我的代码:Haskell中的模式匹配错误,haskell,pattern-matching,parse-error,Haskell,Pattern Matching,Parse Error,我正在编写一个函数,它将布尔列表映射成布尔列表。这是我的代码: y=[False| y<-[0..]] encode :: [[Bool]] -> [Bool] encode x:xs = (zip1 x y):True:True:(encode xs) encode []=[] y=[False | y[Bool] 编码x:xs=(zip1 x y):真:真:(编码xs) 编码[]=[] zip1函数只需要获取两个列表,并将它们交替写入一个新列表 我收到了错误信息
y=[False| y<-[0..]]
encode :: [[Bool]] -> [Bool]
encode x:xs = (zip1 x y):True:True:(encode xs)
encode []=[]
y=[False | y[Bool]
编码x:xs=(zip1 x y):真:真:(编码xs)
编码[]=[]
zip1函数只需要获取两个列表,并将它们交替写入一个新列表
我收到了错误信息
模式中的分析错误:encode
为什么会收到此错误消息?函数应用程序的优先级高于
:
因此,Haskell解析
encode x:xs
作为
这毫无意义,你需要
encode (x:xs)
函数应用程序的优先级高于
:
因此,Haskell解析
encode x:xs
作为
这毫无意义,你需要
encode (x:xs)
它可能只是
encode(x:xs)
它可能只是encode(x:xs)
它可能是