Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I am interested in using OCaml or Haskell to 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.

like image 801
mahonya Avatar asked Aug 15 '11 09:08

mahonya


People also ask

How does Java implement functional programming?

This is primarily achieved in Java using functional interfaces, which are target types for lambda expressions and method references. Typically, any interface with a single abstract method can serve as a functional interface. So, we can define a functional interface quite easily.

Can I use functional programming in Java?

Functional Programming in Java teaches Java developers how to incorporate the most powerful benefits of functional programming into new and existing Java code. You'll learn to think functionally about coding tasks in Java and use FP to make your applications easier to understand, optimize, maintain, and scale.

What is functional programming languages in Java?

Functional programming is a programming style in which computations are codified as functional programming functions. These are mathematical function-like constructs (e.g., lambda functions) that are evaluated in expression contexts.

Which are used to facilitate functional programming in Java?

The Functional Java library is an open source library meant to facilitate functional programming in Java. The library provides lots of basic and advanced programming abstractions commonly used in Functional Programming. Much of the library's functionality revolves around the F interface.


1 Answers

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

like image 68
Peter Lawrey Avatar answered Oct 21 '22 17:10

Peter Lawrey