当前位置:网站首页>typeScript - Partially apply a function
typeScript - Partially apply a function
2022-08-04 23:58:00 【MXM_777】
function IsgoodNumber(a:number,v:number){
return v % a ===0
}
function filterArray(a:number[],f:(a:number,b:number)=>boolean){
return a.filter(f)
}
//Example
function ccc(f:(a:number,b:number)=>boolean,a:number){
return (b:number)=>{
return f(a,b)//a is a free variable
}
}
const goodnum =3
const a = [1,2,3,4,56,7,9]
// console.log(a.filter((v)=> v%2 ===0))
console.log(
filterArray(a,(v)=>IsgoodNumber(goodnum,v))
)
// console.log(
// filterArray(a,ccc(IsgoodNumber,goodnum))
// )
边栏推荐
- jenkins send mail system configuration
- LeetCode Hot 100
- mysql基础
- Nuclei (2) Advanced - In-depth understanding of workflows, Matchers and Extractors
- Cloud native - Kubernetes 】 【 scheduling constraints
- Pytorch分布式训练/多卡/多GPU训练DDP的torch.distributed.launch和torchrun
- MySQL基础篇【子查询】
- Implementation principle of golang coroutine
- 未上市就“一举成名”,空间媲美途昂,安全、舒适一个不落
- Xiaohei's leetcode journey: 95. Longest substring with at least K repeating characters
猜你喜欢
【手撕AHB-APB Bridge】~ AMBA总线 之 AHB
OPENCV学习DAY8
手写分布式配置中心(1)
Handwritten Distributed Configuration Center (1)
Security software Avast and Symantec NortonLifeLock merge with UK approval, market value soars 43%
MySQL增删改查基础
SQL association table update
Basic web in PLSQL
学会反射后,我被录取了(干货)
Nuclei (2) Advanced - In-depth understanding of workflows, Matchers and Extractors
随机推荐
【无标题】
Ab3d.PowerToys and Ab3d.DXEngine Crack
PZK学C语言之字符串函数(一)
Chinese and Japanese color style
中日颜色风格
How to burn the KT148A voice chip into the chip through the serial port and the tools on the computer
After another 3 days, I have sorted out 90 NumPy examples, and I can't help but bookmark it!
Nuclei(二)进阶——深入理解workflows、Matchers和Extractors
Xiaohei's leetcode journey: 95. Longest substring with at least K repeating characters
OPENCV学习DAY8
线程三连鞭之“线程的状态”
IDEA 文件编码修改
关于使用read table 语句
what is MVCC
956. 最高的广告牌
使用OpenCV实现一个文档自动扫描仪
安全软件 Avast 与赛门铁克诺顿 NortonLifeLock 合并案获英国批准,市值暴涨 43%
jenkins发送邮件系统配置
Modelers experience sharing: model study method
#yyds dry goods inventory #Switching equipment serious packet loss troubleshooting