Ändringar mellan två versioner
Här visas ändringar i "Hello Erlang" mellan 2013-08-30 14:34 av Johan Montelius och 2015-09-01 13:22 av Johan Montelius.
Visa < föregående ändring.
Hello Erlang
This seminar is not compulsory but highly recomended for those of you that need help in learning Erlang. We will do some Erlang programming and explore how messages can be sent across a network. If you do not have any problems programming in Erlang you can safely skip this seminar.
* An Erlang Primer
After this seminar you're expected to know how to work in a Erlang programming environment. You should be able to write, compile and run smaller Erlang programs.
At the six'th flKTH student computer roorm If you work with the KTH computers on six'th floor, you will not be able to run Erlang distributed over the network. You can however run several Erlang shells on the same computer and let them communicate with each other. In order to start Erlang in local distribution mode you start Erlang as follows:
erl -sname foo -setcookie secret
and
erl -sname bar -setcookie secret
Now check which name your erlang node has with the call node(). It will probably say something like foo@pc9826. Now, if you register a process under a name "q" then the you should be able to send a message to this process using
{q, 'foo@pc9826'} ! hello.
Ubuntu and other linux users If you're using Ubuntu you could install Erlang in less than three minutes. However the repository in for example Ubuntu does no longer include the erlang-wx module. We use wxWorks, a graphics package, for som of the labs and to get it to work with Erlang we need the erlang-wx module. The simplest solution is to instead go to Erlang Solutions and install the latest version of the Erlang systems. When you do this you might have to reolve some dependencies but you should be up and running in no time.
Choose your favorite packet manager and search for "erlang". Choose the main erlang paket and if you want to use Emacs as a development environment also choose "erlang-mode". The "erlang-doc" packet is also nice since then you will have the html documentation local on your machine.
If you're running other operating systems, you will find packets for most platforms at Erlang Solutions. If not you should be able to compile a system using the source found at www.erlang.org. The Erlang system is ported to most platforms so it should not be a problem.
Emacs It's only fun to use Emacs if you learn the twenty most common commands using ctr- and esc-sequences. If you google on "emacs commands" you will find many good listings that wil explain what you need to know.
Warning, once you master Emacs there is no going back!