score:22
The best known are OCaml and F# (which can be vaguely described as OCaml for .NET).
There are many other multi-paradigm languages, like Oz, but they have mostly pedagogical value. By contrast, OCaml is very practical. It's almost as fast as C and almost as beautiful as Haskell :)
The popular scripting languages like Python and Ruby let you program in functional style as well. However, they don't provide one of the strongest facilities that "classical" functional languages (as well as OCaml) have: pattern matching (don't mistake it for regexp).
score:-1
Ruby! In Ruby, everything is an object (even literals), and it also has full functional programming support.
score:0
I'm wondering why you are looking for a language that specifically encourages mixing it up rather than just doing it anyway with a language that does functional programming and OO programming well? It could be easily brought into effect with Python, Ruby, Perl or similar interpreted languages. In addition C based OO languages tend to mix pure C with OO features, for example Objective C could easily be written in such a way should you choose.
EDIT: I have been made aware I'm incorrect, I've left this answer here incase someone can learn from my mistake - see comments.
score:0
in my experience, C# is very good for this purpose. in c# u can delegate Functions and even with the extension methods you can mimic OOP behavior but with FP in mind.
I usually build a class with behaviors that I needed, then build some functions to do my dirty works around it with FP practices and this works well, and as u mentioned Debug Heaven.
in my opinion, Pure FP and Pure OOP both bring some shortcomings that the others won't. OOP tends to complicate the code vs FP makes it harder for some businesses to code especially when the state is essential.
score:1
Python, javascript, common lisp, ruby, smalltalk, haskell, and ocaml, off the top of my head. It's not really an exotic combination.
score:3
As long as you don't insist on "purity", Common Lisp supports all your needs.
score:4
You're really asking the wrong question. Your question is premised on there being a distinction between "OO" and "functional" programming. This distinction isn't interesting or relevant. In fact, according to the "supports first-class function" criteria, even Java is functional.
But you hit the nail on the head with "purely functional". That's the interesting bit. What languages offer you referential transparency and purity like that? Well, most of them, if you're very careful. But not many of them actually guarantee that your functions are pure. I can only think of a couple of languages that offer you that.
One of them is Haskell. In Haskell, you write programs that are purely functional from beginning to end. Side-effects are delegated to a data structure called IO, and state is handled by passing it through pure functions or encapsulating it in monads. So you have your "debugging heaven" where only a small portion of your code interacts with global state and the rest of your program is pure, and purity is enforced by the language.
score:7
JavaScript, Python, and Ruby could be used that way, but Scala bumps up a notch by typing the function statically and working under JVM.
score:7
C#. It's imperative, which can be handy, but also has a lot of functional features. Lambdas, iterators, and LINQ are all functional.
It probably won't appeal much to purists, but it works for me.
score:9
OCaml and F# are the most popular languages that mix OOP and FP, as far as I know.
Most languages, like Ruby, mix functional programming in, but a lot of people don't even realize it. I find languages like that leave a lot to be desired on the syntax front and such.
score:11
Haskell: Pure functional ,pretty much no OO, but go ahead, take the dive. :D
Scala: Beautiful mix of OO and FP, could possibly overtake java as premier language on the JVM in a decade or 2. I like it because it brings functional programming to the java platform, something that's sorely need IMHO.
C#: Awesome support for OO, as well as getting more functional (first class functions already, we'll see what improvements .net 4 brings)
F#: .net language Built to be functional specifically, as opposed to C#, which was originally conceived for OO stuff.
Python: Great for OO, but not at all suited to FP
Javascript: Supports first-class functions, but not specifically designed for FP like Scala and F#. Still slightly better than python IMHO.
Why do you want to mix OO and FP? As a stepping stone?
score:12
- OCaml
- O'Haskell (and object oriented programming is somewhat possible even in normal Haskell)
- Nemerle
- Possibly newLISP
Also, many scripting languages such as Python, Ruby, Lua, etc. have this capability, but lack many of the nice features of functional languages such as algebraic data types and pattern matching.
score:23
Javascript: OO and functional.
Source: stackoverflow.com
Related Query
- Mixing object-oriented and functional programming
- Difference between reduce and foldLeft/fold in functional programming (particularly Scala and Scala APIs)?
- Batch processing and functional programming
- AbstractMethodError when mixing in trait nested in object - only when compiled and imported
- Simple sum of two numbers file i/o in F#, Haskell, Scala, and Visual Basic or other functional programming languages
- Difference between a function and a method in terms of Functional programming
- Choosing between side effects and good API design in functional programming with scala
- How are the columns and rows counted in pascal function in Functional Programming Principles in Scala at coursera?
- Scala functional programming and mutability
- I/O functional programming, and java programming
- Exploring Akka Typed Actors Functional Vs Object Oriented Way
- Scala object oriented programming
- Play Framework Scala Functional Programming Confusion - Mappings and Compression
- Scala - why actor model is an example of mixing OO and functional programming?
- Solve Coin Change Problems with both functional programming and tail recursion?
- Where should one draw the line between functional programming and imperative programming in a hybrid language like Scala?
- Difference between object and class in Scala
- Difference between case object and object
- What are the relationships between Any, AnyVal, AnyRef, Object and how do they map when used in Java code?
- Functional programming - is immutability expensive?
- Functional Programming - Lots of emphasis on recursion, why?
- Functional Reactive Programming in Scala
- Functional programming, Scala map and fold left
- Scala: How do I dynamically instantiate an object and invoke a method using reflection?
- Is Scala functional programming slower than traditional coding?
- Object-oriented programming in a purely functional programming context?
- Real World Functional Programming in Scala
- val and object inside a scala class?
- What are the main differences between Scala and Frege (in programming paradigms)?
- Can I do Aspect Oriented Programming in Scala?
More Query from same tag
- How to reference a custom SBT Setting in sub-projects
- Scala: Cats, OptionT[Future, T] and ApplicativeError
- custom nifi processor - writing of flow file
- Comet JSON push to javascript
- Using magellan geospatial library with apache spark for standalone applications
- Simulate input from stdin when running a scala program in intellij
- scala: empty constructor for a class with type tag
- Scala how to reference a method that with an implicit parameter
- @tailrec error "recursive call targetting a supertype"
- Scala [Functional]: Find the actual indices of an element within a list that may be repeated
- Scala read multidimensional array line by line
- Scala: for expressions show unexpected behaviour
- Slick table Query: Trouble with recognizing values
- How can I modify an int type argument to a T type?
- import ExecutionContext.global and ExecutionContext.Implicits.global at the same time in scala
- why closures are part of scala or any functional programming language
- Synapse spark select column with space
- What's the meaning of "$" in Dataset's operators (like select or filter)?
- Scala class wrapping a partially applied constructor - how to use it to create API methods?
- Spark Dataframe except method Issue
- Adding SBT as a dependency in SBT file
- Generic inheritance in Scala
- How to convert an imperative double for-loop to functional style without return in Scala?
- Generics in SCALA
- Scala hashmap of listbuffers
- Function to return the same output for any input in Scala
- Sort in descending order, using hive table in spark scala
- Unable to get SBT to download itself from behind Artifactory Pro corporate proxy
- Slick issue when going with PostgreSQL
- Decode incomplete ADT with Circe