Erlang
wiki kor : http://xper.org/wiki/seminar/ErlangLanguage
What is Erlang?
Erlang is a programming language used to build massively scalable soft real-time systems with requirements on high availability. 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.
If you are running a unix system type "erl" or, if you are running on windows start Erlang by clicking on the Erlang start icon. You should see something like this:
Erlang R14B (erts-5.8.1.1) [source] [smp:2:2] [rq:2] [async-threads:0] [kernel-poll:false]
Eshell V5.8.1.1 (abort with ^G)
1>
The ">" prompt means the system is waiting for input.Using Erlang as a calculator
12
2>
Remember to terminate every expression with a DOT followed by a newline!
Previous expressions can be retrieved and edited using simple emacs line editing commands. The most common of these are:
- ^P fetch the previous line.
- ^N fetch the next line.
- ^A Go to the beginning of the current line.
- ^E Go to the end of the current line.
- ^D Delete the character under the cursor.
- ^F Go forward by one character.
- ^B Go Back by one character.
- Return Evaluate the current command.
Note: ^X means press Control + X
Try typing Control+P to see what happens.
Type the following into a file using your favorite text editor:
-export([fac/1]).
fac(0) -> 1;
fac(N) -> N * fac(N-1).
Save the file as test.erl The file name must be the same as the module name.
Compile the program by typing c(test) then run it:
{ok,test}
30> test:fac(20).
2432902008176640000
4> test:fac(40).
815915283247897734345611269596115894272000000000
32>
Now go and write some games!
'프로그래밍 > Architect' 카테고리의 다른 글
[Open SW] Source Navigator (0) | 2013.09.24 |
---|---|
[OSX] Shuttle — SSH shortcut menu for OS X (0) | 2013.08.05 |
[단어] 이상, 이하, 초과, 미만 에 대한 정의 (0) | 2013.07.01 |
TDD, BDD (0) | 2013.06.13 |
도로명에 따른 우편번호 신규 내려받기 (0) | 2013.06.04 |