开发者

How do you integrate functional programming languages to Java or C#? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.

Want to improve this question? Update the question so it focuses on one problem only by editing this post.

Closed 6 years ago.

Improve this question

I am interested in using OCaml or Haskell 开发者_如何学Pythonto develop an engine for statistical computing. This functionality is supposed to work on data that is going to be provided by a model driven, Object Oriented information system. The whole thing needs to scale up and out.

I can see a lot of benefits in using Haskell for example, but getting the data in an out of the Haskell code is tricky. There are always out of the box options like C/C++ interfaces or JNI, but in an architecture which is supposed to scale, I find these approaches problematic and error prone.

Considering FP is on the rise, how do people integrate these languages into widely used languages, hence technologies such as Java? I have been using ZeroMQ and Protocol Buffers for Eiffel to Java integration for example, but are there any options which has proven to be stable and high performance?

Ps: Stackoverflow warns me that this question appears subjective, but I am asking about actual technical solutions to connect different runtimes. I have no intention of discussing pros/cons of any language or paradigm.


Have you considered using Scala? It supports functional programming on a JVM platform. You could integrate it with Java, but you might find that is not needed.

You may also find it is faster than Haskell, esp. with tighter integration with Java.

http://benchmarksgame.alioth.debian.org/u64q/which-programs-are-fastest.html


F# will give you functional programming with the .Net platform for "free".

OcamlJava can interface Java with Ocaml:

OCaml-Java is an effort to make Objective Caml available on the Java platform, currently supporting 3.11.2. The project has two concrete objectives: first, the ability to run Objective Caml sources that have been compiled using ocamlc; second, the ability to compile Objective Caml sources into executable jar files.


You use languages such as Scala, i.e. languages that already run on the JVM.

There are plenty functional languages that run on the JVM and thus integrate quite nicely with the rest of the java code.

My favorite is Scala, but there is also Clojure and Groovy, just to mention a few.


Using Scala or F# would be the real solutions as others say, but just in case if you like something easier to start with, you can also do some functional programming in Java (or C#) like these people https://www.google.com/search?q=functional+programming+java as FP is a programming style that favors immutability.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜