See playground:
https://rescript-lang.org/try?version=v11.1.3&code=DYUwLgBATiC2D2A3EBJAdgExADwgXggAoBDKKAGggEtMcBKfAPgCgIJSoBaRgKQGcAdAEEyxAJ4AmAXwAOwKgGNUaAArBiSwgD8Z8PnhpZslLTATI8ARjrcqAczTwYzZqEhmkyowHUqYABZCGBj4RByUhvRMrOxk3PzCopLScorKahog2rr6kcYQpnCeVibEwXgA2gC6Noz2jjBAA
let removeIndex = (arr, index) =>
arr->Js.Array2.spliceInPlace(~pos=index, ~remove=1)->ignore
let removeIndexWithAdd = (arr, index) =>
arr->Js.Array2.spliceInPlace(~pos=index, ~remove=1, ~add=[])->ignore
Compiles to
// Generated by ReScript, PLEASE EDIT WITH CARE
function removeIndex(arr, index) {
}
function removeIndexWithAdd(arr, index) {
arr.splice(index, 1);
}
export {
removeIndex ,
removeIndexWithAdd ,
}
/* No side effect */
See playground:
https://rescript-lang.org/try?version=v11.1.3&code=DYUwLgBATiC2D2A3EBJAdgExADwgXggAoBDKKAGggEtMcBKfAPgCgIJSoBaRgKQGcAdAEEyxAJ4AmAXwAOwKgGNUaAArBiSwgD8Z8PnhpZslLTATI8ARjrcqAczTwYzZqEhmkyowHUqYABZCGBj4RByUhvRMrOxk3PzCopLScorKahog2rr6kcYQpnCeVibEwXgA2gC6Noz2jjBAA
Compiles to