Questions tagged [erlang-shell]

Erlang comes with an interactive shell where you can try out your Erlang code. There are some differences compared to writing Erlang code in a file and compiling it; most notably you can't define functions in the shell, only assign anonymous functions to variables.

Erlang comes with an interactive shell where you can try out your Erlang code. There are some differences compared to writing Erlang code in a file and compiling it; most notably you can't define functions in the shell, only assign anonymous functions to variables.

The shell comes with a set of predefined functions. See also the full manual.

290 questions
26
votes
2 answers

How do you unbind variables in an interactive Erlang session?

In the Erlang interactive shell you can bind variables to values. If I would like to clear everything and start from scratch without exiting the session and starting a new one, how do I do that? And if I just wanted to re-use a single variable, is…
Torbjørn
  • 6,423
  • 5
  • 29
  • 42
19
votes
1 answer

Disable jumping cursor in Erlang shell

When typing () in IEx 1.2.4, the cursor would "jumping" to the matching parenthesis for 1s and move back. Even though it's not really jumping but it's kinda annoying to the eye. Is there a way to disable this feature in IEx? EDIT: While the…
sbs
  • 4,102
  • 5
  • 40
  • 54
18
votes
7 answers

Can I disable printing lists of small integers as strings in Erlang shell?

The Erlang shell "guesses" whether a given list is a printable string and prints it that way for convenience. Can this "convenience" be disabled?
Alexey Romanov
  • 167,066
  • 35
  • 309
  • 487
14
votes
6 answers

How to create a list of 1000 random numbers in Erlang?

I'm sure that there is a function for that. I just want to make a list of 1000 numbers, each one of them which should be random.
USer22999299
  • 5,284
  • 9
  • 46
  • 78
13
votes
3 answers

In the Erlang shell, how can I automatically read all my record definition headers

This started off as the question: Almost every time when I use the Erlang shell, I'd like to run some command on shell startup, e.g. something like rr("*.hrl"). Or similar. Currently I have to type it every time I start a Erlang shell and I'm…
Peer Stritzinger
  • 8,232
  • 2
  • 30
  • 43
11
votes
1 answer

Erlang remote shell not working

I have some strange behaviour on my docker containers (CentOS). When I SSH into it there's a running instance of Erlang VM (api@127.0.0.1) I can't connect to it with -remsh argument, however I can ping it. My Erlang node (api@127.0.0.1) works…
Kuba Odias
  • 143
  • 1
  • 4
10
votes
2 answers

How to run a custom function when starting an Erlang shell / node? (That is, a function within an `.erl` file)

I can start an Erlang file either via the command line or bash script: exec erl file.erl But, I cannot seem to find out how to directly start a function within this file. e.g. exec erl file.erl -f function() Any suggestions appreciated...
Ted Karmel
  • 1,046
  • 1
  • 12
  • 20
9
votes
1 answer

How to execute system command in Erlang and get results using os:cmd/1?

When I try to execute following command that returns error or doesn't exit on Windows - I always get empty list instead of error returned as string so for example: I get: [] = os:cmd("blah"). instead of something like "command not found" =…
user3169252
  • 1,139
  • 1
  • 9
  • 13
7
votes
2 answers

Can I add include directories to the erl command?

When compiling an erlang file with erlc I can add additional include directories like so: erlc -I /home/trotter/code/open-source/yaws/include src/myapp.erl When I'm compiling from within erl though, I don't see a way to do this on the command line.…
Trotter
  • 1,270
  • 11
  • 13
6
votes
3 answers

How to get Erlang to show UI components "debugger" and "observer" on Linux?

I'm running Kubuntu 15.04 64-bit and trying to get Erlang's 18.1 'debugger' or 'observer' to run (EDIT: from within the shell): observer:start(). debugger:start(). I get the following error: {error,{{load_driver,"No driver found"}, …
user11937
6
votes
1 answer

Short Circuit Erlang Port Mapper Daemon

Given a known TCP port and name for a remote beam.smp service, as well as a known cookie, is it possible to short circuit the Erlang Port Mapper Daemon handshake phase of the Erlang distribution protocol and establish an Erlang shell directly to the…
Anthony Roe
  • 143
  • 1
  • 5
5
votes
3 answers

How to connect two Erlang nodes running on different host machines in the network?

I have two Linux machines connected using a LAN cable. Each machine is able to ping the other. Machine A has IP: 192.168.137.1 on its Ethernet eth0. Machine B has IP: 192.168.137.2 on its Ethernet eth0. On Machine A's terminal: ping…
aeon
  • 83
  • 6
5
votes
3 answers

Why the output differs in these two erlang expression sequence in shell?

In Erlang shell why the following produces different result? 1> Total=15. 2> Calculate=fun(Number)-> Total=2*Number end. 3> Calculate(6). exception error: no match of right hand side value 12 1> Calculate=fun(Number)-> Total=2*Number end. 2>…
Greg
  • 369
  • 1
  • 6
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
0 answers

How To Get ANSI Escape Sequences Working in Erlang Werl?

Erlang R17.0 x64 on Windows 7 x64. When I type clear in a werl window, I see the ANSI escape sequence displayed. I also tried clear()--same result. From my digging around it looks like werl should be able to handle ANSI escape sequences. Is…
Onorio Catenacci
  • 14,928
  • 14
  • 81
  • 132
1
2 3
19 20