7evwh9n4dg 发表于 2016-5-17 06:48:24

Erlang Primer (1) Mac OS X 上配置 Erlang 开发环境

Erlang Primer (1) Mac OS X 上配置 Erlang 开发环境


[*]Author: 柳大·Poechant(钟超)
[*]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)
Eshell V5.9.1(abort with ^G)
1>3+4.
7
2>3*4.
12
3>hello.
hello

Factorial numbers

-module(test).
-export().
fac(0) -> 1;
fac(N) -> N * fac(N - 1).

Try to run it:

$ erl
Erlang R15B01 (erts-5.9.1)
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

-
转载请注明来自柳大的CSDN博客:Blog.CSDN.net/Poechant
-
页: [1]
查看完整版本: Erlang Primer (1) Mac OS X 上配置 Erlang 开发环境