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

时间:2022-06-01 18:38:32

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

$ erlErlang 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.72>3*4.123>hello.hello

Factorial numbers

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

Try to run it:

$ erlErlang 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).24329020081766400003> test:fac(40).815915283247897734345611269596115894272000000000

Reference

  1. http://imata.cn/mypost/43.htm
  2. http://www.erlang.org/static/getting_started_quickly.html

-

转载请注明来自柳大的CSDN博客:Blog.CSDN.net/Poechant

-