【发布时间】:2017-04-29 14:46:34
【问题描述】:
我需要实现一个函数,它接受Dists 的列表并返回Dists 的列表。我需要该函数仅返回带有标签"pass" 的Dists,但不知何故这不起作用。有什么帮助吗?
data Ex = Ex Float Float String String deriving Show
data NewSt = NewSt Float Float String deriving Show
data Dist = Dist Float NewSt Ex deriving Show
helper1 [] = []
helper1 (Dist x (NewSt midterm1 quiz1 name1) (Ex midterm quiz name label) : xs) = if (label == "pass")
then Dist x (NewSt midterm1 quiz1 name1) (Ex midterm quiz name label) : (helper1 xs)
else helper1 xs
【问题讨论】: