Hacker News new | ask | show | jobs
by rfeather 2983 days ago
Could you elaborate more on the advantages of a functional language?
1 comments

Scientific work should strive to be functional by definition (identical input == identical output), so I could see why a programing language should reflect that.
That's a pretty broad statement. And it's a goal that a lot of scientific work simply doesn't allow for.

Any stochastic process will have variability for a given set of inputs. I think there are more fields within the umbrella of Science where purely functional programming isn't an achievable ideal--let alone a desirable one--than there are where this is a good fit.

You can make the argument that all programming should be functional on its own if you want, and I'm open to that. But this it's pretty sketchy to me to just shoehorn all scientific work into a category of work that should definitionally be functional.

There are huge numbers of scientists who do not agree with that at all.

Any stochastic process will have variability for a given set of inputs

If you're modelling stochastic processes it's important to be able to set the random seed you can reproduce your simulations. So for a given set of inputs you should get the same output, given that one of the inputs is your seed.

Until you change how you consume randomness, and the order isn't the same anymore.
What are these fields in which you can't use functional programming and it isn't desirable? (It's true there should be more engineering done on implementations of scientific stuff.) I've seen how unnatural imperative programming was to physicists who hadn't been exposed to it.
While I agree on a functional outlook, you're going to have a hard time generally making efficient, deterministic parallel programs, particularly distributed ones.