Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

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?

share|improve this question

closed as off-topic by gnat, GlenH7, MichaelT, Bart van Ingen Schenau, Kilian Foth Oct 27 at 15:05

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions asking us to recommend a tool, library or favorite off-site resource are off-topic for Programmers as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it." – gnat, GlenH7, MichaelT, Bart van Ingen Schenau, Kilian Foth
If this question can be reworded to fit the rules in the help center, please edit the question.

    
This link could help you ftp.cs.york.ac.uk/pub/malcolm/thesis.html. Download the postscript file and read it. –  Ubermensch Mar 2 '12 at 14:07
    
@Ubermensch thanks but I'm getting an error when I try to access that link. –  Onorio Catenacci Mar 2 '12 at 14:27
3  
Please take a look at this SO question. It appears to be very closely realted to what you've asked. And this page dealing with programming the Arduino with Haskell.Atom –  Bhargav Bhat Mar 2 '12 at 15:28
    
@BhargavBhat thank you. –  Onorio Catenacci Mar 2 '12 at 15:29
1  
You may also be interested in reading Using Haskell for sizable real-time systems: how (if?)? –  Mark Booth Mar 5 '12 at 12:16

2 Answers 2

up vote 2 down vote accepted

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.

share|improve this answer
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 '12 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 '12 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.

share|improve this answer

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