Unfortunately the signature wont make this function pure.
What you would need in this case is composition which would allow you to compose 2 functions. I will at one point cover composition, in the mean time, you can read that great article by Eric Elliott --> medium.com/javascript-scene/master...
Hey! I'm YCMJason, a Software Engineer in London 👨💻. Love diving into tech puzzles and sharing them! 🧩
All views expressed here are my own opinions, so please take them with a pinch of salt! 🧂
Unfortunately the signature wont make this function pure.
What you would need in this case is
composition
which would allow you to compose 2 functions. I will at one point cover composition, in the mean time, you can read that great article by Eric Elliott --> medium.com/javascript-scene/master...Why not?
@tuxOr
There is nothing to do with the signature of a function.
A function is pure if and only if
So in your example, assuming
process(var1, var2)
will make some side effect somewhere else in the program, it is not a pure function.However, if
process
do not make any changes, then it will still be a pure function.I think I understood now, thank you!