Skip to main content
Copy edited. In English, the subjective form of the singular first-person pronoun, "I", is capitalized, along with all its contractions such as I'll and I'm.
Source Link
Peter Mortensen
  • 31.4k
  • 22
  • 110
  • 134

I think many of JSthe JavaScript instructions are not well thought out for functional programming. Splice returns the deleted element where most of the time you need the reduced array. This is bad. 

Imagine you are doing a recursive call and hashave to pass an array with one less item, probably without the current indexed item. Or imagine you are doing another recursive call and has to pass an array with an element pushed.

In netiherneither of these cases you can do myRecursiveFunction(myArr.push(c)) or myRecursiveFunction(myArr.splice(i,1)). The first idiot will infactin fact pass the length of the array and the second idiot will pass the deleted element as a parameter.

So what iI do in fact... For deleting an array element and passing the resulting to a function as a parameter at the same time iI do as follows

myRecursiveFunction(myArr.slice(0,i).concat(a.slice(i+1))) 

When it comes to push that's more silly... I do like,

myRecursiveFunction((myArr.push(c),myArr)) 

I believe in a proper functional language a method mutating the object it's called upon must return a reference to the very object as a result.

I think many of JS instructions are not well thought for functional programming. Splice returns the deleted element where most of the time you need the reduced array. This is bad. Imagine you are doing a recursive call and has to pass an array with one less item, probably without the current indexed item. Or imagine you are doing another recursive call and has to pass an array with an element pushed.

In netiher of these cases you can do myRecursiveFunction(myArr.push(c)) or myRecursiveFunction(myArr.splice(i,1)). The first idiot will infact pass the length of the array and second idiot will pass the deleted element as a parameter.

So what i do in fact... For deleting an array element and passing the resulting to a function as a parameter at the same time i do as follows

myRecursiveFunction(myArr.slice(0,i).concat(a.slice(i+1))) 

When it comes to push that's more silly... I do like,

myRecursiveFunction((myArr.push(c),myArr)) 

I believe in a proper functional language a method mutating the object it's called upon must return a reference to the very object as a result.

I think many of the JavaScript instructions are not well thought out for functional programming. Splice returns the deleted element where most of the time you need the reduced array. This is bad. 

Imagine you are doing a recursive call and have to pass an array with one less item, probably without the current indexed item. Or imagine you are doing another recursive call and has to pass an array with an element pushed.

In neither of these cases you can do myRecursiveFunction(myArr.push(c)) or myRecursiveFunction(myArr.splice(i,1)). The first idiot will in fact pass the length of the array and the second idiot will pass the deleted element as a parameter.

So what I do in fact... For deleting an array element and passing the resulting to a function as a parameter at the same time I do as follows

myRecursiveFunction(myArr.slice(0,i).concat(a.slice(i+1))) 

When it comes to push that's more silly... I do like,

myRecursiveFunction((myArr.push(c),myArr)) 

I believe in a proper functional language a method mutating the object it's called upon must return a reference to the very object as a result.

I think many of JS instructions are not well thought for functional programming. Splice returns the deleted element where most of the time you need the reduced array. This is bad. Imagine you are doing a recursive call and has to pass an array with one less item, probably without the current indexed item. Or imagine you are doing another recursive call and has to pass an array with an element pushed.

In netiher of these cases you can do myRecursiveFunction(myArr.push(c)) or myRecursiveFunction(myArr.splice(i,1)). The first idiot will infact pass the length of the array and second idiot will pass the deleted element as a parameter.

So what i do in fact... For deleting an array element and passing the resulting to a function as a parameter at the same time i do as follows

`myRecursiveFunctionmyRecursiveFunction(myArr.slice(0,i).concat(a.slice(i+1)))` 

When it comes to push that's more silly... I do like,

`myRecursiveFunctionmyRecursiveFunction((myArr.push(c),myArr))` 

I believe in a proper functional language a method mutating the object it's called upon must return a reference to the very object as a result.

I think many of JS instructions are not well thought for functional programming. Splice returns the deleted element where most of the time you need the reduced array. This is bad. Imagine you are doing a recursive call and has to pass an array with one less item, probably without the current indexed item. Or imagine you are doing another recursive call and has to pass an array with an element pushed.

In netiher of these cases you can do myRecursiveFunction(myArr.push(c)) or myRecursiveFunction(myArr.splice(i,1)) first idiot will infact pass the length of the array and second idiot will pass the deleted element as a parameter.

So what i do in fact... For deleting an array element and passing the resulting to a function as a parameter at the same time i do as follows

`myRecursiveFunction(myArr.slice(0,i).concat(a.slice(i+1)))` 

When it comes to push that's more silly... I do like,

`myRecursiveFunction((myArr.push(c),myArr))` 

I believe in a proper functional language a method mutating the object it's called upon must return a reference to the very object as a result.

I think many of JS instructions are not well thought for functional programming. Splice returns the deleted element where most of the time you need the reduced array. This is bad. Imagine you are doing a recursive call and has to pass an array with one less item, probably without the current indexed item. Or imagine you are doing another recursive call and has to pass an array with an element pushed.

In netiher of these cases you can do myRecursiveFunction(myArr.push(c)) or myRecursiveFunction(myArr.splice(i,1)). The first idiot will infact pass the length of the array and second idiot will pass the deleted element as a parameter.

So what i do in fact... For deleting an array element and passing the resulting to a function as a parameter at the same time i do as follows

myRecursiveFunction(myArr.slice(0,i).concat(a.slice(i+1))) 

When it comes to push that's more silly... I do like,

myRecursiveFunction((myArr.push(c),myArr)) 

I believe in a proper functional language a method mutating the object it's called upon must return a reference to the very object as a result.

Source Link
Redu
  • 26.3k
  • 6
  • 61
  • 84

I think many of JS instructions are not well thought for functional programming. Splice returns the deleted element where most of the time you need the reduced array. This is bad. Imagine you are doing a recursive call and has to pass an array with one less item, probably without the current indexed item. Or imagine you are doing another recursive call and has to pass an array with an element pushed.

In netiher of these cases you can do myRecursiveFunction(myArr.push(c)) or myRecursiveFunction(myArr.splice(i,1)) first idiot will infact pass the length of the array and second idiot will pass the deleted element as a parameter.

So what i do in fact... For deleting an array element and passing the resulting to a function as a parameter at the same time i do as follows

`myRecursiveFunction(myArr.slice(0,i).concat(a.slice(i+1)))` 

When it comes to push that's more silly... I do like,

`myRecursiveFunction((myArr.push(c),myArr))` 

I believe in a proper functional language a method mutating the object it's called upon must return a reference to the very object as a result.