# curryN

```erlang
curryN :: (Number arity, Function f) => Function g
```

## description

Returns a [curried version](https://en.wikipedia.org/wiki/Currying) of the provided function. The new function will have the specified arity. `curry` is a *pure function* and will return a new function, without modifying the original function.

`curryN` is very similar to [`curry`](https://conductor.js.org/api-reference/curry), except you need to explictly provide the desired arity. `curry` actually uses `curryN` internally and is defined as follows: `curry = fn => curryN(fn.length, fn)`. In most cases, [`curry`](https://conductor.js.org/api-reference/curry) or [`arity`](https://conductor.js.org/api-reference/arity) will be better suited to your needs. The only case where you might want to use `curryN` would be if your function's `length` property does not reflect its actual arity (either because it uses the spread parameter operator, or uses the [`arguments`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/arguments) local variable internally).

## examples

### basic example

```javascript
import { curryN } from 'conductor'

const multiply = (x, y) => x * y
const times3 = curryN(2, multiply)(3)

times3(5) // 15
```

### 0-arity functions

```javascript
import { curryN } from 'conductor'

function multiply() {
  return arguments[0] * arguments[1]
}
multiply.length // 0
curryN(2, multiply).length // 2
const times3 = curryN(2, multiply)(3)

times3(5) // 15
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://conductor.js.org/api-reference/curryn.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
