3 ms·
What stuff is functional programming bad at? You can just introduce loops and mutation with tail recursion and get all the "benefits" of imperative code.
by smabie 6y ago
What stuff is functional programming bad at? You can just introduce loops and mutation with tail recursion and get all the "benefits" of imperative code.
- carlob 6y agoNot OP. First of all I wanna say that Mathematica/Wolfram Language is not just functional and certainly not purely functional. Thus said, I feel trying to be purely functional has its drawbacks whenever you have to keep track of a lot of stuff that requires state: for example if you have to declare that some of your constants are real you end up having to use Assuming or Assumptions a lot and that can get verbose quickly. Setting the $Assumptions global makes for terser code. If you wanna dig more into the differences of the two approaches in the same language you can look at the xAct package vs. the built-in symbolic tensors: xAct has many more features but feels less idiomatic, because you have to set they type of your symbols beforehand and expressions are not really self-contained.