Wednesday 6 November 2013

See! It lives!

Everything you need to start development with the Erlang language is available as a download from www.erlang.org at http://www.erlang.org/download.html. The download is 90MB ish. The download installs all the tools - compiler, REPL shell etc - and documentation and the "OTP" which provides comprehensive libraries including even code to build a database and create GUI applications. What they call a platform. Anyway they seem to have thought of everything.

BTW, OTP stands for Outlaw Techo Psychobitch - there is an excellent video presentation also available online (Erlang The Movie The Sequel) that clarifies the marketing decisions behind unexpectedly vivid nomenclature.

When it's installed you get a link to a REPL Shell and a link to the Documentation. The documentation link takes you to an HTML home page within the documentation with links to reference files and to a Quickstart Guide. The Documentation you get with the download is comprehensive. There are matching HTML and PDF versions of the documentation for each module. These are housed in the sub-folders for each module so I swept up all the PDF files in the whole Erlang installation and copied them into one central documents folder to make them easier to browse through. Personally I like documents in PDF best.

The Quick Start tells you how to write some trial functions in a file and load them into your Erlang Shell. A Quick Start is important to give the right first impressions. It needs to (a) be quick but more importantly it needs to (b) start. This one annoyed me at first because I ran the Windows Erlang shell from the default setup prompt. You can't load the example programs into that because you are not in the right folder. Hah!  You can use the cd() shell function to change your working folder but I didn't discover this until later. The Help option on the shell just shows you the version number. However there is a command help() in the shell that lists the commands, but I didn't find that until later either.

You can't define functions in the shell - - which some have complained about.  I don't think you can define functions in the Haskell shell either.  Best place for a function definition is in a separate little file anyway, surely?

Anyway the command to exit the shell is q(). The full stop at the end matters.  Better to run the command line Erlang shell with the command erl from the command line and then you can be in whatever folder you want:

C:\Users\polly\Erlang>erl
Eshell V5.10.2 (abort with ^G) 
1> 2+2. 

2> q(). 
ok 
3> 
C:\Users\polly\Erlang> 

See, Igor! It lives! It lives!

No comments:

Post a Comment