小编Uns*_*der的帖子

你怎么写数学| x | 在哈斯克尔?

你如何得到(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)

两个值之间的差异必须是正的.

math haskell module

2
推荐指数
2
解决办法
172
查看次数

哈斯克尔.将名称分配给值的阈值

我想弄清楚如何在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代码中?

haskell function threshold

-1
推荐指数
1
解决办法
86
查看次数

如何编写较短的代码,以便更广泛地使用它?

我正在编写一个简单的搜索引擎,该引擎应该给出一个数据单元的单独参数。有没有更好(更短)的方式来编写此代码?提前致谢。

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)

haskell

-2
推荐指数
1
解决办法
69
查看次数

标签 统计

haskell ×3

function ×1

math ×1

module ×1

threshold ×1