Erlang Primer (1) Mac OS X 上配置 Erlang 开发环境
- Author: 柳大·Poechant(钟超)
- Email: zhongchao.ustc#gmail.com (# -> @)
- Blog: Blog.youkuaiyun.com/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
-
转载请注明来自柳大的优快云博客:Blog.youkuaiyun.com/Poechant
-
本文详细介绍了如何在MacOSX上安装和配置Erlang开发环境,并通过示例展示了基本的Erlang shell操作及模块定义方法。

被折叠的 条评论
为什么被折叠?



