Wraps a constructor inside a curried factory whose arity you choose (official Ramda docs). That lets variadic constructors (where fn.length is 0) still wait for n arguments — no new at the call site.
Stable since v0.4.0:R.constructN is a core Ramda helper — not deprecated, experimental, or non-standard. Use it when fn.length is wrong (variadic / rest args). Prefer R.construct when length is already honest.
Syntax
Call R.constructN. Start with this line.
Ramda
R.constructN(n, fn)
Call
What it does
R.constructN(n, fn)
Primary signature.
R.constructN(...)
Call the function helper.
Prefer import { constructN } from "ramda" when you want a named import.
Library declarations
Ramda
R.constructN(n, fn)
Parameters
Parameter
Description
n
Required. Arity of the returned factory
fn
Required. Constructor to wrap
Return Value
Return Value
Description
*
Curried factory; instance when fully applied
Ramda Examples
Example 1 — Official ThreeLayerSalad
Wrap a variadic Salad for 3 args, skip new, then print the recipe.
Equivalent wrap.R.construct(Point) is R.constructN(2, Point).
Same point. Both factories build { x: 3, y: 4 }.
Rule of thumb. Prefer construct when length is right; prefer constructN for variadic / rest / defaults that shrink length.
Compatibility
Browser & Runtime Support
R.constructN() is ordinary JavaScript once Ramda is loaded. It needs no special browser API — only a JS runtime that can run Ramda v0.4.0+.
✓ Ramda 0.4.0+ · Any JS runtime
Ramda.js R.constructN()
Works in every modern browser and runtime where you can load Ramda 0.4.0 or later (CDN or npm). Older Ramda builds before 0.4.0 do not include constructN.
100%With Ramda 0.4+
Google ChromeSupported · Desktop & Mobile
Full support
Mozilla FirefoxSupported · Desktop & Mobile
Full support
Apple SafariSupported · macOS & iOS
Full support
Microsoft EdgeSupported · Chromium
Full support
Internet ExplorerNo native support · Use a polyfill
Polyfill
OperaSupported · Modern versions
Full support
Samsung InternetSupported · Android
Full support
BunSupported · JavaScript runtime
Supported
DenoSupported · JavaScript runtime
Supported
Node.jsSupported · Server runtime
Supported
Android WebViewSupported · Modern WebView
Full support
R.constructN()Universal
Bottom line: Safe in any project that includes Ramda 0.4.0 or later. Load ramda.min.js from a CDN in the browser, or npm install ramda for Node, Bun, and Deno.
Frequently Asked Questions
R.constructN(n, fn) wraps a constructor in a curried factory with arity n. You call it with n arguments (one call or several) and get back an instance of the same type — without writing new at the call site. The n argument exists so variadic constructors still work.
function Salad() stores arguments as ingredients. ThreeLayerSalad = R.constructN(3, Salad), then ThreeLayerSalad('Mayonnaise')('Potato Chips')('Ketchup').recipe() prints three Add a dollop of ... lines. Added in v0.4.0.
R.construct reads fn.length. A constructor that only uses arguments reports length 0, so construct calls new Fn() with no args. R.constructN(n, fn) lets you name the arity. R.construct(fn) is R.constructN(fn.length, fn).
Not at the call site. constructN uses new for you when all n arguments are supplied. ThreeLayerSalad('Mayonnaise')('Potato Chips')('Ketchup') is the same kind of object as new Salad('Mayonnaise', 'Potato Chips', 'Ketchup').
Yes. After n arguments arrive, you get an instance. ThreeLayerSalad('Mayonnaise')('Potato Chips')('Ketchup') and ThreeLayerSalad('Mayonnaise', 'Potato Chips', 'Ketchup') both work. constructN itself is also curried, so R.constructN(3)(Salad) is valid.
No. R.constructN is a stable Ramda function helper from v0.4.0. It is not deprecated, experimental, or non-standard.