I was discussing F# and Functional Programming with a friend last night and he brought up an interesting question to me. How would you do embedded software in functional? I mean this seems like a fairly natural fit in terms of stateless code but embedded also entails being very frugal with memory and I'm not sure of the story for functional in that regard.

Any suggestions about languages or packages for embedded with functional?


2 Answers 2


Forth is an excellent choice for embedded systems programming. Being a stack language, it can be analysed in terms of function composition (concatenative programming). I see no reason why such a language with more functional aspects could not also be implemented efficiently, but as yet no such thing (to my knowledge) exists.

  • 1
    Concatenative programming is a very different paradigm to Functional programming, but there is a functional forth (funforth) which implements some simplified aspects of the Haskell functional language language.
    – Mark Booth
    Mar 5, 2012 at 12:14
  • @MarkBooth: Not so different; concatenative programming (pretty much by definition) makes heavy use of higher-order combinators, and many functional concepts translate directly into concatenative code.
    – Jon Purdy
    Mar 6, 2012 at 19:09

One option is Erlang. From the wikipedia page:

Erlang is a general-purpose concurrent, garbage-collected programming language and runtime system. The sequential subset of Erlang is a functional language, with strict evaluation, single assignment, and dynamic typing. For concurrency it follows the Actor model. It was designed by Ericsson to support distributed, fault-tolerant, soft-real-time, non-stop applications. It supports hot swapping, so that code can be changed without stopping a system.

While threads are considered to be a complicated and error-prone topic in most languages, Erlang provides language-level features for creating and managing processes with the aim of simplifying concurrent programming. Though all concurrency is explicit in Erlang, processes communicate using message passing instead of shared variables, which removes the need for locks.

The first version was developed by Joe Armstrong in 1986.2 It was originally a proprietary language within Ericsson, but was released as open source in 1998.

  • Although Erlang may be used in systems that require low-level programming it seems the low-level parts are typically not done in Erlang but in C (Erlang FAQ, "What sort of problems is Erlang not particularly suitable for?"). May 12 at 14:15

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