erlang-shell

Erlang remote shell not working

巧了我就是萌 提交于 2019-11-28 03:15:09
问题 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 correctly though. bash-4.2# ./bin/erl -name 'remote@127.0.0.1' -remsh 'api@127.0.0.1' Eshell V6.1 (abort with ^G) (remote@127.0.0.1)1> node(). 'remote@127.0.0.1' (remote@127.0.0.1)2> net_adm:ping('api@127.0.0.1'). pong (remote@127.0.0.1)3> erlang:system

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

北城余情 提交于 2019-11-27 23:30:26
问题 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. 回答1: To generate a 1000-element list with random numbers between 1 and 10: [rand:uniform(10) || _ <- lists:seq(1, 1000)]. Change 10 and 1000 to appropriate numbers. If you omit the 10 from from the rand:uniform call, you'll get a random floating point number between 0.0 and 1.0. On Erlang versions below 18.0: Use the random module instead. Caution! You need to run

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

蓝咒 提交于 2019-11-27 01:58:33
The Erlang shell "guesses" whether a given list is a printable string and prints it that way for convenience. Can this "convenience" be disabled? mpm You can disable such behavior with shell:strings/1 function starting with Erlang R16B. Just remember that this is option global to all node shells, and it might be wise to set it back after finishing playing is shell in longer living nodes. tux21b I don't know if it's possible to change the default behavior of the shell, but you can at least format your output correctly, using io:format . Here is an example: 1> io:format("~p~n", [[65, 66, 67]]).

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

自古美人都是妖i 提交于 2019-11-26 08:28:01
问题 The Erlang shell \"guesses\" whether a given list is a printable string and prints it that way for convenience. Can this \"convenience\" be disabled? 回答1: You can disable such behavior with shell:strings/1 function starting with Erlang R16B. Just remember that this is option global to all node shells, and it might be wise to set it back after finishing playing is shell in longer living nodes. 回答2: I don't know if it's possible to change the default behavior of the shell, but you can at least