Skip to content

Files

Latest commit

7978933 · Dec 26, 2023

History

History
This branch is 56 commits behind type-challenges/type-challenges:main.

00017-hard-currying-1

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Currying 1 hard #array

by Anthony Fu @antfu

Take the Challenge    简体中文 日本語

TypeScript 4.0 is recommended in this challenge

Currying is the technique of converting a function that takes multiple arguments into a sequence of functions that each take a single argument.

For example:

const add = (a: number, b: number) => a + b
const three = add(1, 2)

const curriedAdd = Currying(add)
const five = curriedAdd(2)(3)

The function passed to Currying may have multiple arguments, you need to correctly type it.

In this challenge, the curried function only accept one argument at a time. Once all the argument is assigned, it should return its result.


Back Share your Solutions Check out Solutions

Related Challenges

14・First of Array 16・Pop 462・Currying 2