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

Erlang - Interleave the easy way

Whats the easy/efficient way of interleaving three data sets.. Data1 = [<<5>>,<<6>>,<<7>>], Data2 = [<<5>>,<<6>>,<<7>>], Data3 = [<<5>>,<<6>>,<<7>>]. End Result: Final = [<<5>>, <<5>>, <<5>>, <<6>>, <<6>>, <<6>>, <<7>>, <<7>>, <<7>>] Im sure its…
BAR
  • 15,909
  • 27
  • 97
  • 185
5
votes
3 answers

what's the difference between list_to_binary and iolist_to_binary?

I only know list_to_binary in erlang otp, but today I see iolist_to_binary? I tried it in erlang shell, but I can't find the difference. (ppb1_bs6@esekilvxen263)59> list_to_binary([<<1>>, [1]]). <<1,1>> (ppb1_bs6@esekilvxen263)60>…
BlackMamba
  • 10,054
  • 7
  • 44
  • 67
5
votes
1 answer

What is the c program exit(0) equivalent function call in erlang?

How to kill the erlang program within erlang program? exit/1 command does not behave same as c language standard library exit call.
Talespin_Kit
  • 20,830
  • 29
  • 89
  • 135
5
votes
0 answers

Erlang, pass an nif object between functions

I write a C nif code and in function new, it creates a stack struct with enif_alloc_resource and returns that. when i use function enif_make_resources, it always returns <<>> in erlang. Here is my C code: #include "erl_nif.h" static…
Amin
  • 755
  • 6
  • 21
5
votes
2 answers

Reorder elements in Erlang

I want to redefine the order of a tuple looking for specific words Example, I have a list of tuples like this: [{"a",["r001"]}, {"bi",["bidder"]}, {"bo",["an"]}] But sometimes the order of the tuples can change for example: [{"bi",["bidder"]}, …
user1000622
  • 519
  • 1
  • 7
  • 18
5
votes
1 answer

Using fully qualified function calls in Erlang?

I have just learnt how to upgrade a module in Erlang and I know that only the function calls that use the fully qualified names (eg. module:function()) gets "relinked" to the current version loaded into the VM, but the function calls that do not…
goodolddays
  • 2,595
  • 4
  • 34
  • 51
5
votes
4 answers

Design pattern? Function iterating through a list in search of the first {success} result

I've got a coding problem in Erlang that is probably a common design pattern, but I can't find any info on how to resolve it. I've got a list L. I want to apply a function f to every element in L, and have it run across all elements in L…
monch1962
  • 5,151
  • 5
  • 31
  • 38
5
votes
1 answer

How do you get the Erlang debugger to execute a conditional break?

Given a positive number N, my print_even() function prints out all the even numbers between 1 and N: -module(my). -compile(export_all). print_even(N) when N>0 -> even_helper(1, N). even_helper(Current, N) when Current =< N -> …
7stud
  • 46,922
  • 14
  • 101
  • 127
5
votes
2 answers

Can you link two processes in Erlang if the current process is neither one?

It is possible to call link(pid) in Erlang to link the currently executing process to the process identified by pid. Is it possible to link a process to another if it is not currently executing?
John Cochran
  • 145
  • 1
  • 1
  • 5
5
votes
1 answer

Why I am getting illegal pattern on pattern matching?

1> X = 10. 10 2> Y = 9. 9 3> X - 1 = Y. * 1: illegal pattern 4> Y = X - 1. 9 5> 10 - 1 = Y. 9 Can you explain to me what illegal pattern in query 3> is? Thanks!
moon2sun00
  • 51
  • 6
5
votes
2 answers

Best clock or number generator function for concurrency/scalability on Erlang OTP 18?

Currently in the process of converting an erlang application from version 17 to 18. Scalability and performance are prime directives in the design. The program needs a way to differentiate and sort new input coming in, either with lots of unique…
user3355020
  • 315
  • 1
  • 9
5
votes
1 answer

How is a list constructed by the Erlang VM (BEAM)?

When I create a list in Erlang, such as in the Erlang shell: 1> [1, 2]. From what I understand, in the vm this list will be represented as a singly linked list. How is this structure created by the Erlang runtime? For example, is it constructed…
Chris Snow
  • 23,813
  • 35
  • 144
  • 309
5
votes
5 answers

List of PID's in Erlang

Long story short I am trying to replicate the Sleeping barber problem in Erlang. In my solution I decided that for all the processes that are waiting I would put them into a list. Then, once it was that processes turn, I would take that PID off of…
Toymakerii
  • 1,510
  • 2
  • 12
  • 26
5
votes
3 answers

RabbitMQ Generic server rabbit_disk_monitor terminating / eheap_alloc: Cannot allocate 229520 bytes of memory (of type "old_heap")

RabbitMQ crashed. RabbitMQ was working correctly for many days(10-15 days). I am not getting why it got crashed. I am using RabbitMQ 3.4.0 on Erlang 17.0 The erlang has created dump file for the crash. Which shows eheap_alloc: Cannot allocate…
jasmin9891
  • 53
  • 1
  • 6
5
votes
2 answers

which erlang's pool is suitable?

I hope this pool has a capability (or options) for auto reduce its worker's quantity when these are free for a max idle timeout. I have read the doc of poolboy and worker_pool and found there is only maximum worker quantity option, but no option for…
Chen Yu
  • 3,955
  • 1
  • 24
  • 51