|
|
|
|
|
by lutusp
4854 days ago
|
|
Java can produce any result that Haskell can produce. End of story, full stop. All non-broken computer languages are Turing machines. This is not to suggest that someone would want to use Java for anything sufficiently sophisticated, unless one is a masochist, but then, that wasn't your claim. > As far as I'm aware in Java, there's no way to write a function with a signature that says "Take two numeric arguments of any type". Certainly pre-generics, this is impossible. A separate claim with no meaningful relation to the original one. This claim is that it would be inconvenient, not impossible. |
|
Yes, I'm not disputing this- I'm fully in agreement that all turing-complete languages can compute all turing-computable computations. I've never been trying to argue against that. I'm sorry if I haven't explained myself clearly enough- let me give it another shot.
In Haskell, I can write a function operating on numbers like this:
The AD library means I can do this: and g will behave as if I'd declared As far as I'm aware, it's not possible to write this code in Java- you can't get the differentiated version of a Java function this way.You can compute the same results, of course. You just can't write a library that will accept a function and give back its differentiation.
You can write a function that takes some representation of a mathematical function, for example as a string, and build a function from that to compute the same results, but you can't pass in an actual Java function- so you can't write the library. You can write a library which differentiates string-representations-of-functions, but you can't write one that differentiates first-class-Java-functions (well, objects with functions on, but you get the idea. I hope.)