Will there be a functional language which does for the Java community what F# does for the .NET community?
What functional programming languages are available, or in development, for the JVM?
Will there be a functional language which does for the Java community what F# does for the .NET community?
What functional programming languages are available, or in development, for the JVM?
Scala would be the language.
Though not strictly functional (it's a mix of functional and object-oriented) and it is not strictly for Java (there is a .NET version of Scala), that would be the closest analog to F# in the JVM.
The first thing that came to my mind was Scala but really Ocaml-Java comes closer as F# is a variant of Ocaml. See this post that compares Ocaml-Java to Scala:
OCaml programmers are typically over 10x as productive as Java or C++ programmers for a wide range of practical tasks. Despite being based upon a fundamentally OOP platform, F# goes a long way to capturing the productivity- boosting benefits of OCaml (and the whole ML family). In contrast, Scala fails to capture many of the benefits including some really basic ones and, consequently, writing correct code is much more difficult in Scala than in any real ML.
Moreover, the ML family of languages are designed to be succinct but Scala is needlessly verbose for everything from "Hello world!" upwards. The ML family of languages provide extensive type inference (OCaml more than most) but Scala has only rudimentary inference by comparison. OCaml has an unusually expressive type system but Scala adds little to OOP that is of practical importance.
Actually, I might be wrong, but I don't expect F# to be as mainstream as the other .NET languages; useful in a few circles (academic, compilers, a few other scenarios) - however, don't forget that C# offers FP usage - and it gets better each time: C# 1.2 has delegates; C# 2.0 has anonymous methods and captures/closures; C# 3.0 has lambdas for simplicity, and Expression for abstraction. Anonymous types (C# 3.0) share some similarity with tuples (in terms of convenience), but obviously are very different beasts, so definitely not a like-for-like comparison.
Maybe not quite as optimised as F#, but for most day-to-day FP use-cases, more than sufficient.
It is also quite clear that better support for immutability (especially for threading) is very much on the minds of the C# language team for future consideration.
My money is on C# getting better at FP, and being the .NET FP offering for most day-to-day purposes. Of course, there will be some F# usage - but (purely subjective) I simply don't see there being a huge migration.
For now I would say Scala. But for the future, I'd have a look at Fortress. The first implementation of the spec was released on April 1, 2008. And no, that is not a joke. Key featues are:
More info at the Project Fortress Community website and the Wikipedia Fortress page.
Perhaps Clojure. It's not statically typed, but it has more of an emphasis on immutability and concurrency than F. However, like F# (and unlike Common Lisp), it is intended to be a primarily functional language that it good at consuming OO libraries from the underlying platform.
@Marc Gravell - functional languages are increasingly used in the guts of enterprise grade financial systems. We use many functional (pure or "semi-pure") at the bank I work for...
Arguably none because the JVM lacks tail calls and they are required to make almost all functional code robust with respect to stack consumption.
The nearest thing to functional language implementations on the JVM are Clojure, Scala and the OCaml-Java project. Although there are workarounds for the lack of tail calls (e.g. trampolining), none of these language implementations do this because the workarounds introduce even more serious problems, e.g. crippling performance and completely obfuscating debugging.
Sun have been talking about tail calls for years and, more recently, have indicated that they intend to implement them imminently. As soon as that is done, I am sure we will see a lot more language diversity on the JVM and, in particular, some production-quality functional language implementations. Until then, I regard all of these languages as toys.
Cheers, Jon Harrop.
There's a good list of programming languages for JVM, including functional programming paradigm and other paradigm languages on:
My first pick is Scala (multi-paradigm; OO & FP), I spent a 5+ months studing Scala in 2009, and created a quick reference sheet: bchiprog.blogspot.com/2009/05/scala-cheat-sheet.html
I noticed there are other programming paradigms that are interesting, other focuses on parallel processing such as X10, Fortress, and Chapel. X10 is implemented on top of Scala - http://www.scala-lang.org/sites/default/files/odersky/scalaliftoff2009.pdf
It's really based on what problem you need to solve then pick the language that can best solve it. I think it's developers' wish that there's one language that can solve any type of problem easily and doing it simply.