当前位置:网站首页>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))
// )
边栏推荐
- 统计单词(DAY 101)华中科技大学考研机试题
- uniapp horizontal tab (horizontal scrolling navigation bar) effect demo (organization)
- 使用OpenCV实现一个文档自动扫描仪
- IDEA file encoding modification
- Implementation principle of golang coroutine
- Nuclei (2) Advanced - In-depth understanding of workflows, Matchers and Extractors
- Go 语言快速入门指南:什么是 TSL 安全传输层
- MYS-6ULX-IOT 开发板测评——使用 Yocto 添加软件包
- 4 - "PyTorch Deep Learning Practice" - Backpropagation
- 407. 接雨水 II
猜你喜欢

Develop a SpaceX website based on the Appian low-code platform
![Couple Holding Hands [Greedy & Abstract]](/img/7d/1cafc000dc58f1c5e2e92150be7953.png)
Couple Holding Hands [Greedy & Abstract]

uniapp horizontal tab (horizontal scrolling navigation bar) effect demo (organization)

365天深度学习训练营-学习线路

uniapp动态实现滑动导航效果demo(整理)

KT6368A蓝牙的认证问题_FCC和BQB_CE_KC认证或者其它说明

【LeetCode】Summary of Two Pointer Problems

Basic web in PLSQL

Pytorch分布式训练/多卡/多GPU训练DDP的torch.distributed.launch和torchrun

【论文笔记】—低照度图像增强—Unsupervised—EnlightenGAN—2019-TIP
随机推荐
2022 Niu Ke Summer Multi-School Training Camp 5 (BCDFGHK)
对写作的一些感悟
IDEA file encoding modification
Detailed explanation of common DNS resource record types
4 - "PyTorch Deep Learning Practice" - Backpropagation
ansible学习笔记分享-含剧本示例
KT148A语音芯片怎么烧录语音进入芯片里面通过串口和电脑端的工具
407. 接雨水 II
MYS-6ULX-IOT 开发板测评——使用 Yocto 添加软件包
Uniapp dynamic sliding navigation effect demo (finishing)
MongoDB权限验证开启与mongoose数据库配置
10 个关于 Promise 和 setTimeout 知识的面试题,通过图解一次说透彻
小黑leetcode冲浪:94. 二叉树的中序遍历
Go 语言快速入门指南:什么是 TSL 安全传输层
node中package解析、npm 命令行npm详解,node中的common模块化,npm、nrm两种方式查看源和切换镜像
Some thoughts on writing
MongoDB permission verification is turned on and mongoose database configuration
mysql基础
安全软件 Avast 与赛门铁克诺顿 NortonLifeLock 合并案获英国批准,市值暴涨 43%
[CVA Valuation Training Camp] Financial Modeling Guide - Lecture 1