-
Notifications
You must be signed in to change notification settings - Fork 2
Erlang
🚧 NEW PAGE! I though I just make this page for anyone whose interested.
Erlang is a programming language used to build massively scalable soft reap-time systems with requirements of high availablity . Some of its uses are in telecoms, banking, e-commerce, computer telephony, and instant messaging. Erlang's runtime system has built-in support for concurrency, distribution, and fault tolerance.
TLDR: It's a scalable programming language.
Erlang's bread and butter is OTP, a set of erlang libraries and design principles providing middle-ware to develop systems. It isncludes it's own distributed database, applications to interface towards other languages, and debugging and release handling tools.
When I was installing [Apache Thrift](Apache Thrift) for GNU Radio, one of the add on options was for Erlang. We'll want to install OTP and Rebar3, Erlang's build too.
What you'll defintely need
- GNU
make - A C compler like GCC or [Clang](LLVM and Clang)
- Perl 5 (which you should have on your system if you ae using Linux or UNIX.)
- GNU
m4 -
ncurses,termcap, ortermlib. To make this easy, follow the instructions for Tmux installation. -
sed, the stream editor. If you don't have it,apt-getit. Ditto forgawkbecause for some reason a lot of other AWKs that aren'tgawkhave been installed lately. - GNU
autoconf
I also recomend these "optional" components.
- OpenSSL (
libssl-devor something.) - Oracle's version of Java. (I've got instructions for that.)
-
flex, which means you should also downloadbison. - X Windows -- The development headers and libraries are needed to build the Erlang/OTP application
gs. Hopefully that doesn't clash with GhostScript - wxWidgets
TODO: I need to add instructions for installing the documentation!
$ cd ~/Software
$ mkdir erlang
$ cd erlang
$ git clone https://github.com/erlang/otp/
$ git clone https://github.com/erlang/rebar3/
$ cd otp
$ ./otp_build autoconf # generate the configure file.
$ ./configure
$ ./make -j4
$ sudo make install
$ cd ..
$ cd rebar3
$ ./boostrap
$ ./rebar3 local install
$ echo "export PATH=\$PATH:\$HOME/.cache/rebar3/bin" >> ~/.bashrc # Add rebar3 to your PATH!
Erlang and Rebar3 should now be installed.
Erlang should be located at /usr/local/bin/erl. If you ask where erlang is with whereis it will point to /usr/local/lib/erlang which is not the application, and which will reply nothing. However, if you use whereis or which with erl, it will point to /usr/local/bin/erl
I wish the Erlang folks would have considered putting Rebar3 in /usr/local and that they would have added a link to erl called erlang.
I didn't install documentation for Erlang because of how this installation instructions were written and how the installation was structured.
Much like Scala, Erlang has several way you can write your code.
Notice that lines in Erlang end with a period.
$ erl -noshell -eval 'io:fwrite("Hello, world!\n"), init:stop().'
Hello, World!
Use a text editor to make hello.sh
#! /usr/bin/env escript
% HelloWorld.erl.sh
main(_) -> io:fwrite("Hello, world!\n").
Run it like this
$ chmod u+x hello.erl.sh
$ ./hello.erl.sh
Hello, World!
Of course, most people would prefer to work with erlang like they would with Scala or Java: Compilation and Execution
% hello.erl
-module(hello).
-export([start/0]).
start() ->
io:fwrite("Hello, world!\n").
Compile and execute. erlc hello.erl creates hello.beam.
$ erlc hello.erl
$ erl -noshell -s hello start -s init stop
Hello, world!
That is completely nasty. It works, but I think that erl step could have been nicer. I'll have to look up a better version of this later.
TODO: Find a better
erlcompile command or a betterhello.erlfile.
Erlang does have a REPL. To leave it press Ctrl+</kbd> (backslash) or use init:stop().
It turns out in this example, yo need to write hello.erl first, which is why this section followed the previous section.
$ erl
Erlang/OTP 18 [erts-7.3] [source-523e048] [smp:4:4] aync-threads:10] [hipe] [kernel-poll:false]
Eshell V7.3 (abort with ^G)
1> c(hello).
{ok,hello}
2> hello:start().
Hello, world!
ok
3> % Ctrl+\
- Erlang's EDoc documentation generator is inspired by Javadoc, but uses the same style of comments used in PostScript
Setup
- [Assemble the Hardware](Assemble the Hardware)
- [Install the Software](Install the Software)
- SD Card Formatting and Image Mounting
- ❤️ [TLDR version](Install the Software#tldr)
- 🆕 [Windows version](Install the Software#doing-this-in-windows)
- 🆙 [Setup your Raspberry Pi](Setup your Raspberry Pi)
- [Download the Missing Parts](Download the Missing Parts)
- Clone this repo
- 🆕 [Install these first](Install these first)
-
Python(It's taken care of) - 🆙 CMake
- 🆙 Node
- 🆕 Expect (Tcl/Tk is not dead!)
- 🆙 tmux and ncurses
- 🆙 htop
- 🆙 wavemon
- Vim
- 🆙 Ruby
- 🆙 weechat
- 🆕 urxvt 256 color terminal!
- 🆕 i3 A better window manager
- 🆕 Ranger
- 🆙 Qt5
- 🆕 Chromium
wicd-curses- 📻 Software Defined Radio
- 🎮 [Linux Toys](Linux Toys)
Typical Utilities
- [Downloading and extracting with curl and tar](curl and tar)
- [Browsing with ls and cat](ls and cat)
- [Searching with grep and find](grep and find)
- [Filtering with sed and awk](sed and awk)
- [Piping with less, pv, and tee](less, pv, and tee)
- Monitor your system with htop
- Multiplex with tmux