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
2 answers

What is the best way to assert the contents of a zip archive in Elixir?

Currently what I am doing: Testing function by letting it zip a file/directory. Assert it exists. Using :zip.t and :zip.tt let it list down the contents of the zip folder to see if it's what I am expecting. Somehow I think I am missing…
Muhammad Lukman Low
  • 8,177
  • 11
  • 44
  • 54
5
votes
1 answer

httpc get request fails with 404 when auth headers are included

I'm using Erlang's httpc to make a get request with parameters and with a basic auth header. When used without the header in httpc/1, like this: url = String.to_char_list("https://endpoint.com/endpoint?param=foo") :httpc.request(url) I get the…
Dania_es
  • 1,026
  • 1
  • 10
  • 20
5
votes
1 answer

Function as an argument in Erlang

I'm trying to do something like this: -module(count). -export([main/0]). sum(X, Sum) -> X + Sum. main() -> lists:foldl(sum, 0, [1,2,3,4,5]). but see a warning and code fails: function sum/2 is unused How to fix the code? NB: this is…
kharandziuk
  • 12,020
  • 17
  • 63
  • 121
5
votes
0 answers

All languages except English literals parsed in GCM POST request

A partial solution was given by: Parsing ASCII characters with Erlang Case 1: this worked fine for Hindi…
Dummy Bee
  • 259
  • 3
  • 13
5
votes
1 answer

How to start distributed Erlang app without starting dependencies at every node?

I tried to run a simple app in a distributed manner to test failover-takeover features but failed. What I want to: The application is myapp_api with a rest api, it has myapp application as a dependency. I want to start myapp_api on 3 nodes, I want…
user2461860
  • 103
  • 5
5
votes
1 answer

Erlang spawning large amounts of C processes

I've been looking into how I could embed languages (let's use Lua as an example) in Erlang. This of course isn't a new idea and there are many libraries out there that can do this. However I was wondering if it was possible to start a Genserver with…
user967965
5
votes
2 answers

Getting a sibling process in Elixir

I have an Elixir/Erlang process tree: parent (Supervisor) ├── child1 (GenServer) └── child2 (GenServer) child1 (a DB client) has information that child2 needs to use. What's a good way to pass a reference from the Supervisor process to child2 so…
Brian Hicks
  • 6,213
  • 8
  • 51
  • 77
5
votes
3 answers

Automatically restarting Erlang applications

I recently ran into a bug where an entire Erlang application died, yielding a log message that looked like this: =INFO REPORT==== 11-Jun-2010::11:07:25 === application: myapp exited: shutdown type: temporary I have no idea what…
Nick
  • 2,411
  • 3
  • 19
  • 12
5
votes
4 answers

Best way to convert list of lists to list of tuples?

What's the best way to convert a list such as [[1,2,3],[a,b,c],[4,5,6]] to a list of tuples like this: [{1,a,4},{2,b,5},{3,c,6}] where tuple N is composed of the Nth element from each of the three sublists? Should I use a tail recursive function, a…
Vignesh Sivam
  • 75
  • 1
  • 8
5
votes
2 answers

Is the computer language 'Erlang' related to the Chinese deity?

Erlang Shen or Erlang is a Chinese deity who supposedly regulates floods, Erlang a computer language ideal for large volume applications. Is this just some kind of weird coincidence?
Chris Huang-Leaver
  • 6,059
  • 6
  • 41
  • 67
5
votes
1 answer

Jabber user going offline: Why the two different scenarios?

I have an Android client working in tandem with ejabberd XMPP server. Observations: Scenario 1: When I swipe-right the app (kill the app), the user goes offline on the server immediately. Its status is changed to offline at that very…
Raina M
  • 123
  • 1
  • 6
5
votes
1 answer

Difference between binary string and ordinary list

I'm new to erlang, and in erlang shell, i typed below expression: A= <<"abc">>. B="abc". I want to know the differences between A and B, and their general usage, Also why below expression is not correct: C=<>.
Huang_Hai_Feng
  • 287
  • 2
  • 13
5
votes
1 answer

Elixir tight-loop speed up

I'm looking for ways to speed up the "tight-loop" in my elixir program. Enum.reduce( list, 0, fn ({c,v},acc) -> v*elem(tuple_array,c) + acc end ) It's simply running through a list of tuples and for each it's doing: a tuple lookup (c is an…
GavinBrelstaff
  • 3,016
  • 2
  • 21
  • 39
5
votes
4 answers

Canonical pattern reference in Actors programming model

Is there a source, which I could use to learn some of the most used and popular practices regarding Actor-/Agent-oriented programming? My primary concern is about parallelism and distribution limited to the mentioned scheme - Actors, message…
Bubba88
  • 1,910
  • 20
  • 44
5
votes
5 answers

Erlang: simple refactoring

Consider the code: f(command1, UserId) -> case is_registered(UserId) of true -> %% do command1 ok; false -> not_registered end; f(command2, UserId) -> case is_registered(UserId) of …
alexey
  • 8,360
  • 14
  • 70
  • 102