Questions tagged [erlang]

Erlang is a general-purpose, garbage-collected programming language and runtime environment, with built-in support for concurrency, distribution and fault tolerance.

Erlang is a general-purpose functional programming language and runtime environment. It has built-in support for concurrency, distribution and fault tolerance. Erlang is used in several large telecommunication systems from Ericsson. Erlang is open source and available for download on GitHub.

Some Erlang features:

Online Resources:

Erlang Books:

9600 questions
22
votes
3 answers

Erlang: Why does this fail with a 'badarith' exception?

Is it possible to implement a closure in Erlang? For example, how would I translate this snippet from Scheme? (define (make-adder n) (lamdba (x) (+ x n))) I've tried the following, but I'm clearly missing something. make_adder(n) -> fun (x)…
grifaton
  • 3,986
  • 4
  • 30
  • 42
22
votes
4 answers

How do I do dependency injection and mocks in erlang?

When writing code in Java, it is very helpful to embrace composition and dependency injection to make it possible and easy to do pure unit testing by mocking collaborating objects. I find that doing the same in Erlang is less straightforward and…
Matteo Caprari
  • 2,869
  • 4
  • 27
  • 35
21
votes
2 answers

Distributed Haskell state of the art in 2011?

I've read a lot of articles about distributed Haskell. Much work has been done but seems to be in the area of distributing computations. I saw the remote package which seems to implement Erlang-style messaging passing but it is 0.1 and early…
user1002430
21
votes
1 answer

Good practices when developing an application in Erlang (and Riak)?

We are getting familiar with Erlang/OTP and Riak (Core, KV, Pipe, and so on) trying to build an open-source distributed application in turn. Our project is going to have a bunch of dependencies : tools like erlang_js, protobuffs, etc., but also…
matehat
  • 5,214
  • 2
  • 29
  • 40
21
votes
1 answer

Very Large Mnesia Tables in Production

We are using Mnesia as a primary Database for a very large system. Mnesia Fragmented Tables have behaved so well over the testing period. System has got about 15 tables, each replicated across 2 sites (nodes), and each table is highly fragmented.…
Muzaaya Joshua
  • 7,736
  • 3
  • 47
  • 86
21
votes
4 answers

Concurrent programming techniques, pros, cons

There is at least three well-known approaches for creating concurrent applications: Multithreading and memory synchronization through locking(.NET, Java). Software Transactional Memory (link text) is another approach to…
user166010
21
votes
2 answers

Erlang as an embedded system within an application?

I have quite a lot of code written in Erlang, which I want to include in applications written in Objective-C, eg on the iPad. Ideally I would want to have an object that encapsulates the Erlang run-time; this could then be accessed like the standard…
Oliver Mason
  • 2,240
  • 2
  • 15
  • 23
21
votes
7 answers

illegal pattern in map of Erlang

The code is below: -module(map_demo). -export([count_characters/1]). count_characters(Str) -> count_characters(Str, #{}). count_characters([H|T], #{ H => N } = X) -> count_characters(T, X#{ H := N+1 }); count_characters([H|T], X) -> …
geeker
  • 345
  • 6
  • 15
21
votes
2 answers

What are some fundamental Feature/Architectural differences between the BEAM and JVM?

What are some fundamental Feature/Architectural difference between the BEAM and JVM? Yes I know: one was originally built around java and the other built around erlang I understand the JVM (somewhat) and want to compare their structures For…
jtzero
  • 2,204
  • 2
  • 25
  • 44
21
votes
7 answers

How To Convert An Elixir Binary To A String?

So I'm trying to convert a binary to a string. This code: t = [{<<71,0,69,0,84,0>>}] String.from_char_list(t) But I'm getting this when I try this conversion: ** (ArgumentError) argument error (stdlib) :unicode.characters_to_binary([{<<70, 0,…
Onorio Catenacci
  • 14,928
  • 14
  • 81
  • 132
21
votes
13 answers

Erlang-style Concurrency for Other Languages

What libraries exist for other programming languages to provide an Erlang-style concurrency model (processes, mailboxes, pattern-matching receive, etc.)? Note: I am specifically interested in things that are intended to be similar to Erlang, not…
Kristopher Johnson
  • 81,409
  • 55
  • 245
  • 302
21
votes
2 answers

Is there an Erlang implementation for Android?

I know of many languages that can be used on Android to build apps, most of them JVM-related, but I have not been able to find an Erlang implementation for it. Is there a port of Erlang for Android? If there is not a good port available, how would…
Philip Conrad
  • 1,451
  • 1
  • 13
  • 22
21
votes
4 answers

Hot code replacement in erlang

I am working on my first real project in erlang, however, this code is simplified for brevity. I want to be able to load a newer version of a file into my project remotely while it's running. I've read about using a behavior like gen_server or…
joneshf
  • 2,296
  • 1
  • 20
  • 27
20
votes
3 answers

Is there a way to tell rebar not to run eunit tests for the dependencies?

When running: ./rebar eunit the tests are run also for the external dependencies. Is there a way to change this behaviour? Maybe through the rebar.config file?
Roberto Aloi
  • 30,570
  • 21
  • 75
  • 112
20
votes
3 answers

When should an Erlang function return ok?

I often see Erlang functions return ok, or {ok, }, or {error, }. Suppose my function returns an integer N. Should my function return just N, or {ok, N}? Or suppose my function includes the call io:function("Yada yada").…
Lloyd R. Prentice
  • 4,329
  • 3
  • 21
  • 31