Erlang primer (1) configure the Erlang Development Environment on Mac OS X
- Author: Liu Da-poechant (Zhong Chao)
- Email: zhongchao. USTC # gmail.com (#-> @)
- Blog: blog.csdn.net/poechant
- Date: May 13Th, 2012
Install
$ ./configure
$ make
$ sudo make install
Start
$ erl
Erlang R15B01 (erts-5.9.1) [source] [smp:4:4] [async-threads:0] [hipe] [kernel-poll:false]
Eshell V5.9.1 (abort with ^G)
1>3+4.
7
2>3*4.
12
3>hello.
hello
Factorial numbers
-module(test).
-export([fac/1]).
fac(0) -> 1;
fac(N) -> N * fac(N - 1).
Try to run it:
$ erl
Erlang R15B01 (erts-5.9.1) [source] [smp:4:4] [async-threads:0] [hipe] [kernel-poll:false]
Eshell V5.9.1 (abort with ^G)
1> c(test)
1> .
{ok,test}
2> test:fac(20).
2432902008176640000
3> test:fac(40).
815915283247897734345611269596115894272000000000
Reference
- Http://imata.cn/mypost/43.htm
- Http://www.erlang.org/static/getting_started_quickly.html
-
Reprinted, please indicate the csdn blog from LIU Da: blog.csdn.net/poechant
-