<p>Java has <a href="http://www.scala-lang.org/" rel="noreferrer">Scala</a> and .NET has <a href="http://research.microsoft.com/fsharp/" rel="noreferrer">F#</a>.  Both of these languages are very highly integrated into the respective Java and .NET platforms.  Classes can be written in Scala then extended in Java for example.</p>

<p>Does there exist an equivalent functional language that interoperates highly with C++?</p>

[{'answer_id': 24998, 'author': 'Konrad Rudolph', 'author_id': 1968, 'author_profile': 'https://Stackoverflow.com/users/1968', 'pm_score': 3, 'selected': False, 'text': '<p>C++ doesn\'t have an ecosystem in the sense of Java or .NET. There\'s no virtual machine, no runtime environment even, there\'s only a highly specialized standard library that by design doesn\'t operate well in a purely functional environment. C++ doesn\'t even have an <a href="http://en.wikipedia.org/wiki/Application_binary_interface" rel="noreferrer">ABI</a> standard.</p>\n\n<p>All things considered, I\'m not sure what you mean/expect.</p>\n'}, {'answer_id': 24999, 'author': 'Henrik Gustafsson', 'author_id': 2010, 'author_profile': 'https://Stackoverflow.com/users/2010', 'pm_score': 2, 'selected': False, 'text': '<p>Since Scala compiles into Java bytecode and F# compiles into .NET bytecode, made to run on their respective virtual machines. The correct comparison would be if there is some functional language that compile to machine dependant code, ready to run on a computer, and yes, there are.</p>\n\n<p>I don\'t think that was what you meant though, but the best I have to offer is <a href="http://sourceforge.net/projects/fcpp/" rel="nofollow noreferrer">FC++</a>. <a href="http://www.boost.org/" rel="nofollow noreferrer">Boost</a> is another library which has a lot of features that can be recognized as derived from functional programming.</p>\n\n<p>However, I\'d wager there are no \'real\' functional programming C++:es out there.</p>\n'}, {'answer_id': 25000, 'author': 'Konrad Rudolph', 'author_id': 1968, 'author_profile': 'https://Stackoverflow.com/users/1968', 'pm_score': 3, 'selected': False, 'text': '<p>Ah, something else. Although this certainly isn\'t what you meant, <a href="http://en.wikipedia.org/wiki/Template_metaprogramming" rel="noreferrer">template metaprogramming</a> in C++ is purely functional.</p>\n'}, {'answer_id': 25028, 'author': 'Tom Lokhorst', 'author_id': 2597, 'author_profile': 'https://Stackoverflow.com/users/2597', 'pm_score': 3, 'selected': False, 'text': '<p>As has been said, I\'m not really sure about a C++ \'ecosystem\'. But <a href="http://haskell.org/" rel="noreferrer">Haskell</a> does have a Foreign Function Interface that allows you to call C functions from Haskell and Haskell functions from C.</p>\n\n<p>Then again, that\'s C, I\'m not really sure how far along the C++ FFI is...</p>\n'}, {'answer_id': 25246, 'author': 'vzczc', 'author_id': 224, 'author_profile': 'https://Stackoverflow.com/users/224', 'pm_score': -1, 'selected': False, 'text': '<p>C++ may not be a pure functional language, but parts of STL are certainly functional.</p>\n\n<p>See  <a href="http://www.research.att.com/~bs/bs_faq.html" rel="nofollow noreferrer">Bjarne Stroustrup FAQ</a> (the inventor of the c++)</p>\n'}, {'answer_id': 25334, 'author': 'Andy Brice', 'author_id': 455552, 'author_profile': 'https://Stackoverflow.com/users/455552', 'pm_score': 2, 'selected': False, 'text': "<p>The 'D' language was designed as a successor to C++. A purely functional subset of D is being developed by Andrei Alexandrescu for D 2.0. I am guessing D interoperates well with C++.</p>\n"}, {'answer_id': 25340, 'author': 'Dale Ragan', 'author_id': 1117, 'author_profile': 'https://Stackoverflow.com/users/1117', 'pm_score': 1, 'selected': False, 'text': '<p>I agree that I am not sure of an ecosystem for C++.  <a href="http://caml.inria.fr/ocaml/" rel="nofollow noreferrer">OCaml</a> is pretty popular for doing functional programming outside of .NET.  F# is also based off of it.</p>\n'}, {'answer_id': 217620, 'author': 'J D', 'author_id': 13924, 'author_profile': 'https://Stackoverflow.com/users/13924', 'pm_score': 3, 'selected': False, 'text': '<p>The <a href="http://felix-lang.github.io/felix/" rel="nofollow noreferrer">Felix</a> language by John Skaller is designed to interoperate with C++ and provide the functional paradigm.</p>\n\n<p>There are problems with doing this though. Functional languages provide first-class functions which allow the creation of closures: functions that have captured and carry values from the environment they were defined in. This makes it impossible to determine the lifetimes of values statically (because a closure might carry a value out of its scope) and, consequently, effectively requires a garbage collector but C++ is not garbage collected.</p>\n'}, {'answer_id': 45035322, 'author': 'Vishal', 'author_id': 1548297, 'author_profile': 'https://Stackoverflow.com/users/1548297', 'pm_score': 0, 'selected': False, 'text': '<p>This question was posted in 2008. For reference, C++11 onwards have support for functional programming. See another discussion updated for this <a href="https://stackoverflow.com/questions/1981400/functional-programming-in-c">Functional Programming in C++</a></p>\n'}]
['https://Stackoverflow.com/questions/24995', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/755/']