What is _ and ...?

i don’t really get the difference… i can do

...->Array.map(fn(x, _))

as well as

...->Array.map(fn(x, ...))

but what’s the actual difference here? also, why does … only work in the slot? should i prefer one or the other? what are their purposes?

_ is a pipe placeholder: Pipe | ReScript Language Manual

… Is partial application: Function | ReScript Language Manual

… only works in one spot, while you can use _ anywhere as a placeholder for a piped argument, which means you can only use it with a pipe. … can be used without a pipe.

1 Like