一个关于haskell的问题Define a function sumnegpos which takes a list of Int values and returns a pair comprising the sum of the negative and the sum of the positive integers in the list,e.g.Main> sumnegpos [2,2,-8,5,-7,-1,0,4,4](-16,17)

来源:学生作业帮助网 编辑:作业帮 时间:2024/07/07 09:28:09
一个关于haskell的问题Define a function sumnegpos which takes a list of Int values and returns a pair comprising the sum of the negative and the sum of the positive integers in the list,e.g.Main> sumnegpos [2,2,-8,5,-7,-1,0,4,4](-16,17)
x呱N@ _c*9MSʐfba jz9]ZFXYA ,,]: VMm_~}ݯo_Z95epL%Ke' ˭-$U594l,%H Kt>)/AhJaY75>tM%=͹qXZH" `lc))p(N1 va +$*Wfy?0]~jq|ɍ% A%d/ Jl5T

一个关于haskell的问题Define a function sumnegpos which takes a list of Int values and returns a pair comprising the sum of the negative and the sum of the positive integers in the list,e.g.Main> sumnegpos [2,2,-8,5,-7,-1,0,4,4](-16,17)
一个关于haskell的问题
Define a function sumnegpos which takes a list of Int values and returns a pair comprising the sum of the negative and the sum of the positive integers in the list,e.g.
Main> sumnegpos [2,2,-8,5,-7,-1,0,4,4]
(-16,17)

一个关于haskell的问题Define a function sumnegpos which takes a list of Int values and returns a pair comprising the sum of the negative and the sum of the positive integers in the list,e.g.Main> sumnegpos [2,2,-8,5,-7,-1,0,4,4](-16,17)
sumnegpos xs = (sum negs, sum pos)
where negs = filter (0) xs