我想添加1个项目到只有一个项目和添加项目(使用toInt转换为整数后)列表中y如果项目数量大于1和最后项目是相同的如何在列表中使用像if then else语句那样的过滤器?
怎么办?
import Data.List.Split
z = splitOn "+" "x^2+2*x^3+x^2"
y = map (splitOn "*") z
x = map head y
toInt :: [String] -> [Int]
toInt = map read
u = filter ((map length y)>1) y
Couldn't match expected type `a0 -> Bool' with actual type `Bool'
In the first argument of `filter', namely `((map length y) > 1)'
In the expression: filter ((map length y) > 1) y
In an equation for `u': u = filter ((map length y) > 1) y
失败,已加载模块:无。
我希望选择列表哪个长度大于1 – Jo0o0 2011-04-17 14:36:21