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
5
votes
1 answer

Erlang receive message -- how is it done internally?

How is the receive message implemented internally in erlang runtime? When the process is waiting for a message, the execution hang on the receive. The receive is done via blocking IO, or asynchronous IO ? If former, then it means the OS thread is…
Mr.Wang from Next Door
  • 13,670
  • 12
  • 64
  • 97
5
votes
2 answers

Simple_one_for_one can only be terminated if appointed SHUTDOWN strategy to brutal_kill?

The supervisor is an OTP behavior. init([]) -> RoomSpec = {mod_zytm_room, {mod_zytm_room, start_link, []}, transient, brutal_kill, worker, [mod_zytm_room]}, {ok, {{simple_one_for_one, 10, 10000}, [RoomSpec]}}. Above code…
goofansu
  • 2,277
  • 3
  • 30
  • 48
5
votes
2 answers

Erlang: what is this process identifier in the form of {from, Pid, Ref}?

I am now facing a problem. when i check the erl_crash.dump, i found some stuff as below: =proc:<0.19275.17> State: Scheduled Spawned as: proc_lib:init_p/5 Spawned by: <0.18723.17> Started: Wed May 8 13:30:40 2013 Message queue length: 1 …
ruanhao
  • 4,663
  • 6
  • 28
  • 43
5
votes
2 answers

How do I install meck with my Erlang project?

I created my first Erlang project. It's a simple secret code game. I'm trying to avoid OTP at all costs because it seems REALLY confusing and my mentor thought it wasn't necessary to use it this go- around. I have three folders: ebin src test I…
Kelly
  • 619
  • 8
  • 18
5
votes
1 answer

Emakefile - custom behaviour undefined

My test project is structured this way: ./Emakefile: {"source/*", [debug_info, {outdir,…
Muja Null
  • 53
  • 3
5
votes
1 answer

Understanding and using foreach in Erlang

I have an assignment to complete a caesar cypher in 7 languages. I'm working on completing it Erlang currently. I've been exposed to functional languages before so I generally understand what I need to do. I'm specifically having trouble…
NickAbbey
  • 1,201
  • 2
  • 10
  • 17
5
votes
1 answer

Erlang: proplists:get_value/2 or pattern matching?

I have a list of tuples that has always the same form (i.e. the tuples come always in the same order): 1> L = [{a, 1}. {b,2}, {c, 3}, {d, 4}]. Knowing that the list has only a few elements, what is the best way to extract the values associated to…
user601836
  • 3,215
  • 4
  • 38
  • 48
5
votes
2 answers

Erlang records with both type and value restrictions as well as default values

I am trying to write a record which represents a bank account: -record(account, { name :: atom(), type :: atom(), balance = 0 :: integer() }). I also want to restrict the balance to always be >= 0. How do I…
2rs2ts
  • 10,662
  • 10
  • 51
  • 95
5
votes
3 answers

need help understanding this erlang code

I'm having trouble understanding this line. [Pid2 ! {delete, V1a} || {Pid1a, V1a} <- PV1a, Pid2 <- P2, Pid1a /= Pid2 ], Here is what I understand: anything before the double pipe "||" is done repeatedly, according what's after the double…
Quincy
  • 1,923
  • 5
  • 27
  • 37
5
votes
1 answer

Decoding PGP keys in Erlang

I'm unable to "pem_entry_decode" GPG public key in Erlang. Public key generated through OpenSSL works fine. I've fixed GPG key as suggested in Erlang - Importing GPG Public Key. #!/usr/local/bin/escript main(_) -> [application:start(X) || X <-…
ram
  • 559
  • 1
  • 5
  • 15
5
votes
1 answer

Is Erlang really fast given it incur many memory copy under the hood?

I am a newbie for Erlang, I understand the language adopts a design of actor model and create the concept of light-weight process, which is key point for high concurrent programming. But, it also adopts the functional programming paradigm, which…
Yang Bo
  • 679
  • 2
  • 8
  • 20
5
votes
2 answers

Workarounds for lack of varargs in Erlang

Completely new to Erlang. I'm trying to define some functions for function composition, such as compose, juxt and pipe but running into the fact that Erlang doesn't have (to my knowledge) varargs so it's difficult to write just one version of such…
Russell
  • 12,261
  • 4
  • 52
  • 75
5
votes
6 answers

No Erlang compile time errors for missing functions

Why is there no compile time errors or warnings when I call a function in another module that doesn't exist or has the wrong arity? The compiler has all of the exports information in a module to make this possible. Is it just not implemented yet or…
Andy Till
  • 3,371
  • 2
  • 18
  • 23
5
votes
2 answers

Erlang: Is there a way to pattern match a record in a receive clause?

I want to do a selective receive where a record property needs to be matched, but whatever syntax I try, I get an "illegal pattern" message. loop(State) -> receive {response, State#s.reference} -> do_something() end. Is this not possible?
John Galt
  • 257
  • 3
  • 6
5
votes
8 answers

csv parser in erlang

for my application i have to parse CSV file using Erlang.following is the code which will parse CSV using Erlang:- parse_file(Fn) -> {ok, Data} = file:read_file(Fn), parse(binary_to_list(Data)). parse(Data) -> lists:reverse(parse(Data,…
Abhimanyu
  • 4,752
  • 7
  • 33
  • 44
1 2 3
99
100