你如何得到(x - y) < 20永远积极的?
我想提出一个条件:
getJOL :: [Int] -> String
getJOL [w,x,y,z] = if x - w < 20 && y - x < 20 && z - y < 20
then "Good calibration"
else "Bad calibration"
Run Code Online (Sandbox Code Playgroud)
两个值之间的差异必须是正的.
我想弄清楚如何在Haskell中编写:
有一个由4个变量组成的列表:[w,x,y,z]通过ghci完成以下内容后:
collection :: Int -> Int -> Int -> Int -> [Int]
collection w x y z = [w,x,y,z]
Run Code Online (Sandbox Code Playgroud)
我想为w,x,y,z的每个阈值赋予"含义".例如:当0 <x <60时,则x ="低",当59 <x <80时,则x ="中",当79 <x <100时,则x ="高"
你如何把它放在Haskell代码中?
我正在编写一个简单的搜索引擎,该引擎应该给出一个数据单元的单独参数。有没有更好(更短)的方式来编写此代码?提前致谢。
type Qualification = [QualAttrib]
type QualAttrib = String
type Name = String
type Type = String
type Provider = String
num1000101 :: Qualification
num1000101 = ["Mathematics","BSc","UCL"]
getQualName a = a !! 0
getQualType a = a !! 1
getProvider a = a !! 2```
Run Code Online (Sandbox Code Playgroud)