Erlang 笔记

来源:互联网 发布:mac能玩哪些腾讯游戏 编辑:程序博客网 时间:2024/04/28 01:31

1.不能够声明指定类型的变量,变量的类型是在运行时确定的

2.The scope of an Erlang Variable is limited to the function it is declared in.

3.No global state

4.Summary of less painfull loops

if you need to perform an action for each element in a list (returning no value) use lists:foreach

if you need to compute a value for each element in a list use list:map

if you need to accumulate a value for each element in a list use lists:foldl or lists:foldr

5.,表示语句块中语句之间的间隔,

   ;表示后面还有候选分支

   .表示函数结束

6.if the erlang philosophy towards errors could be summarized in a slogan,it would be "Let it fail"

7.-include_lib 会忽略应用的版本号

8.“http://” ++ Rest = “http://www.erlang.org” Rest值为"www.erlang.org",习惯用法

9.

-define(Value(call),io:format("~p=~p~n",[??call,call])).

test()->?Value(length([1,2,3])).

>macros1:test().

"length([1,2,3])"=3

 

10.

It is important to order the alternatives properly.Erlang will stop at the first match it finds,so make sure you order the alternatives from most restrictive to least restrictive.

 

 

 

原创粉丝点击