当前位置:网站首页>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))
// )
边栏推荐
- 建模师经验分享:模型学习方法
- Three tips for you to successfully get started with 3D modeling
- Cython
- 【数据挖掘概论】数据挖掘的简单描述
- 游戏3D建模入门,有哪些建模软件可以选择?
- Basic web in PLSQL
- Privacy Computing Overview
- Senior game modelers tell newbies, what are the necessary software for game scene modelers?
- .net (C#) get year month day between two dates
- 4-《PyTorch深度学习实践》-反向传播
猜你喜欢

安全软件 Avast 与赛门铁克诺顿 NortonLifeLock 合并案获英国批准,市值暴涨 43%

建模师经验分享:模型学习方法
情人节---快来学习一下程序员的专属浪漫吧

【LeetCode】Summary of Two Pointer Problems

956. 最高的广告牌

golang 协程的实现原理

【无标题】线程三连鞭之“线程池”

Cloud native - Kubernetes 】 【 scheduling constraints

The master teaches you the 3D real-time character production process, the game modeling process sharing

How to automatically push my new articles to my fans (very simple, can't learn to hit me)
随机推荐
MySQL增删改查基础
Security software Avast and Symantec NortonLifeLock merge with UK approval, market value soars 43%
手写分布式配置中心(1)
找不到DiscoveryClient类型的Bean
Mysql based
Implementing class target method exception using proxy object execution
KT148A语音芯片怎么烧录语音进入芯片里面通过串口和电脑端的工具
2022年华数杯数学建模
DNS常见资源记录类型详解
情侣牵手[贪心 & 抽象]
OPENCV学习DAY8
Couple Holding Hands [Greedy & Abstract]
[Happy Qixi Festival] How does Nacos realize the service registration function?
Handwritten Distributed Configuration Center (1)
Nuclei (2) Advanced - In-depth understanding of workflows, Matchers and Extractors
uniapp horizontal tab (horizontal scrolling navigation bar) effect demo (organization)
【七夕快乐篇】Nacos是如何实现服务注册功能的?
Modelers experience sharing: model study method
Xiaohei's leetcode journey: 95. Longest substring with at least K repeating characters
Essential knowledge for entry-level 3D game modelers