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
19
votes
5 answers

Managing configuration in Erlang application

I need to distribute some sort of static configuration through my application. What is the best practice to do that? I see three options: Call application:get_env directly whenever a module requires to get configuration value. Plus: simpler than…
Ivan Dubrov
  • 4,778
  • 2
  • 29
  • 41
19
votes
2 answers

How does the Erlang compiler handle pattern matching? What does it output?

I just asked a question about how the Erlang compiler implements pattern matching, and I got some great responses, one of which is the compiled bytecode (obtained with a parameter passed to the c() directive): {function, match, 1, 2}. {label,1}. …
deepblue
  • 8,426
  • 13
  • 48
  • 60
19
votes
2 answers

How to get the name of a function?

Is it possible to know the name of a function in itself ? a_function()-> io:format("I am ~p!", [????]). % What to use here?
Bertaud
  • 2,888
  • 5
  • 35
  • 48
19
votes
7 answers

Distinctive traits of the functional languages

It is known that all functional languages share some basic properties like using functions as basic building block for programs with all the consequences like using recursion instead of iteration. However, some fundamental differences also exist.…
Sergey Mikhanov
  • 8,880
  • 9
  • 44
  • 54
19
votes
5 answers

How does one avoid creating an ad-hoc type system in dynamically typed languages?

In every project I've started in languages without type systems, I eventually begin to invent a runtime type system. Maybe the term "type system" is too strong; at the very least, I create a set of type/value-range validators when I'm working with…
drfloob
  • 3,154
  • 1
  • 24
  • 31
19
votes
5 answers

Logging libraries for Erlang/OTP

For logging activity of an Erlang/OTP application, do you simply use a wrapper over disk_log or some other libraries?
Alexey Romanov
  • 167,066
  • 35
  • 309
  • 487
19
votes
1 answer

Who are Bogdan and Björn in "Bogdan/Björn's Erlang Abstract Machine"? (BEAM)

I understand that the acronym for Erlang's virtual machine, BEAM, stands for "Bogdan/Björn's Erlang Abstract Machine". But I can't find definitive reference anywhere to exactly who Bogdan and Björn are. Searching the erlang.org mailing list I do see…
seanomlor
  • 973
  • 1
  • 10
  • 23
19
votes
2 answers

What OS threads get used in Erlang’s abstract machine, BEAM?

I’ve begun studying Erlang and find the BEAM runtime environment fascinating. It’s commonly stated that in Erlang, processes belong to the language rather than the OS (meaning the runtime, meaning BEAM in this case). These are the lightweight,…
Alan
  • 3,815
  • 1
  • 26
  • 35
19
votes
3 answers

Erlang getting error ** 1: syntax error before: '->' **

I have started some hands on in Erlang and I am getting : ** 1: syntax error before: '->' ** whenever i am declaring any function for eg. to calculate sum of a list (this is experimental, of cource there is Built In Function for find sum of a…
pranjal
  • 692
  • 1
  • 6
  • 19
19
votes
3 answers

Why big companies use Mnesia instead of using Riak or CouchDB

I can see 2 big companies like Klarna and Whatsapp are using Mnesia as their in memory database (not sure how they persist data with Mnesia with 2GB limit). My question is: why companies like those, and may be more I don't know, use Mnesia instead…
securecurve
  • 5,589
  • 5
  • 45
  • 80
19
votes
4 answers

How to uninstall or upgrade Erlang/OTP?

How can I uninstall Erlang/OTP which I use make install to build from source earlier. The install is pretty simple by using ./configure;make;make install; The reason to uninstall is that I want to upgrade from Erlang R15B01 to Erlang R15B03. Now I…
Hao
  • 6,291
  • 9
  • 39
  • 88
19
votes
6 answers

Erlang style - case vs function pattern matching

I've got to the stage where I've written quite a bit of Erlang code now, and I can see some style (bad or good) creeping into the way I've been writing it. This particular idiom I'd like some opinion on - is it better (more readable/faster/whatever)…
Alan Moore
  • 1,823
  • 1
  • 14
  • 15
18
votes
4 answers

How to multicast using gen_udp in Erlang?

How do you use gen_udp in Erlang to do multicasting? I know its in the code, there is just no documentation behind it. Sending out data is obvious and simple. I was wondering on how to add memberships. Not only adding memberships at start-up, but…
Sargun Dhillon
  • 1,788
  • 2
  • 18
  • 24
18
votes
3 answers

How does Erlang schedule work for multicore CPU machines?

I am learning Erlang and am quite impressed how easy it is to parallelize work. To practice a bit I dug up the good old Fibanocci sequence. In the following code I try to take advantage of parallelization by computing the expensive products three at…
Hyperboreus
  • 31,997
  • 9
  • 47
  • 87
18
votes
4 answers

Erlang/OTP: Synchronous vs. Asynchronous messaging

One of the things that attracted me to Erlang in the first place is the Actor model; the idea that different processes run concurrently and interact via asynchronous messaging. I'm just starting to get my teeth into OTP and in particular looking at…
sfinnie
  • 9,854
  • 1
  • 38
  • 44