我有这个功能
func1 :: Double -> [(Double,Double)] -> Maybe [(Double,Double)]
...............
func2 :: Double -> [(Double,Double)] -> [(Double,Double)]
func2 d [] = []
func2 d list =
let dsegs1 = func1 d list
dsegs2 = func2 d (tail list)
in fromJust dsegs1 ++ dsegs2
我希望在func2
中实现的简单流程如下:
let x = func2 3.0 list
let y = func2 3.0 (tail list)
let z = func2 3.0 (tail (tail list))
let a = func2 3.0 (tail (tail (tail list)))
调用func2
n 次,直到它最后没有返回任何内容并结束x
,y
,z
,...,{ {1}}。
我该怎么做?
答案 0 :(得分:1)
看起来你想要map (func2 3.0) (tails list)
。