伙计们,我刚刚开始学习haskell(和代码),我遇到了一个我无法弄清楚的问题.所以有这个练习,我必须提出二阶方程的解的数量.
valid a b c = if [a,b,c] == [0,0,0] then False
else (if [a,b] == [0,0] then False
else (if a == 0 then False
else True)) --function to make sure it is a 2nd degree eq
nRaizes a b c = if valid a b c == False then "not a valid eq"
else (if (b^2 - 4 * a * c) > 0 then 2
else (if ((b^2 - 4 * a * c) == 0) then …Run Code Online (Sandbox Code Playgroud)