0
我有這個功能哈斯克爾遞歸
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
ň多次,直到沒有返回最後和concat x
,y
,z
,...,a
。
我該怎麼做?
謝謝..我反正解決了它,但有5行代碼..你的一個很簡單..謝謝你 –