4

Can you program Android Apps in a functional language?

I meant is it possible to program for Android in a language that was designed from the ground up to be functional? I'm aware that you can use the functional components of an OO or a procedural language to program in a functional style, I was asking whether it would be applicable to use one of the "functional languages" on Android.

12
  • 6
    Could you be more specific?
    – Jeremy
    Commented Jun 9, 2012 at 2:33
  • 1
    It depends. Most high level languages, Python for example, support multiple programming paradigms, including functional programming. Your question, as it stands is pretty vague and in order to receive a better answer, you'll need to clarify what you mean. Commented Jun 9, 2012 at 2:37
  • 3
    @mattnz: From the same article "Programming in a functional style can also be accomplished in languages that aren't specifically designed for functional programming." Does the OP want to know if it's feasible or possible? It definitely helps to have more context with which to answer a question. Commented Jun 9, 2012 at 3:39
  • 2
    @mattnz, I know what functional languages are. Just because I commented, doesn't mean I downvoted or voted to close. (I've done neither.) I was simply trying to tease out more information from the OP to get a better idea of what (s)he is really asking. The obvious answer to the question is "yes", but that isn't very useful. The OP hasn't brought anything to the table other than the question itself. I'm sure the OP has a motive for asking, and I think that information would be important when answering.
    – Jeremy
    Commented Jun 9, 2012 at 3:39
  • 2
    @Cassy 1) Requests for clarifications are a good thing, we can't always guess what the OP has in mind (and we have a ton of questions asking about functional languages, when they mean something else entirely), 2) I've moved your last comment into the question (well, not all of it, just the good parts), 3) Even if a question is closed, you can still edit it, add the missing info and have it removed, 4) Questions that ask for a "yes" or "no" answer usually show lack of research and are discourage.
    – yannis
    Commented Jun 9, 2012 at 9:10

2 Answers 2

9

Yes. You can build Android apps in both Scala and Clojure. The question is would apps produced with these languages be up to "production" standards and I think right now the consensus answer is "not yet"


EDIT: Remember I wrote my response almost 3 years ago (as of today). I believe that both Scala and Clojure have come a long way in that time. Plus Kotlin is another good option for building Android apps with a functional language.

4
  • 1
    Thanks It was a simple question and I only wanted a simple anwer. Thanks mattnz too, for making me feel like I'm not going insane.
    – Cassy
    Commented Jun 9, 2012 at 5:24
  • 4
    There is also an option: MonoDroid + Fsharp.
    – SK-logic
    Commented Jun 9, 2012 at 9:53
  • @Cassy - Unfortunately you have stumbled is a reason this site is gaining the nickname closers.stackexchange.com
    – mattnz
    Commented Jun 10, 2012 at 22:13
  • 1
    I think right now the consensus answer is "not yet": Some explanation regarding this would be useful. What is missing?
    – Giorgio
    Commented Nov 25, 2012 at 21:19
0

Yes, you can build Android apps in most (all?) of the languages that can compile down to byte code (JRuby, Scala, Clojure, ...), but the performance is not what you are used to on the Java VM. Dalvik is a different beast, and the various implementations have had to do quite a bit of changes to come up with a decent speed.

Clojure is now quite performant on Android (after 5 years), but is still suffering from the same slow startup times as the other scripted languages (like JRuby). Lean Clojure is doing something about this, though.

A commenter mentioned F#, and that is actually a viable option, but a costly one if you are a single developer. The reason being that this usually means developing using Tamarin Studio, a great, but proprietary IDE that compiles .NET apps into native versions for Android and iOS.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.