erlang中命令行传参,以及类型等。

参考:1.http://www.cnblogs.com/me-sa/archive/2012/03/20/erlang0047.html

   2.http://www.erlang.org/doc/reference_manual/data_types.html 

erlang中类型的转换,原因是在看编译并运行程序一章时,考虑到命令行给erl传值时的不识别问题。
a)命令行通过如下形式传参
$-s M F A
A传入的是一个参数列表,即若调用:$ -s M F 4 5 形式时,传入参数列表为['4', '5'],并且注意这里列表的元素是原子,在使用时不能直接应用其字面值。而需要将对应参数用atom_to_list(),然后再用list_to_integer()函数来得到字面数值。
注意:
integer_to_list(Integer, Base) -> string()

Types:

Integer = integer()
Base = 2..36
Returns a string which corresponds to the text representation of Integer in base Base.

list_to_integer(String, Base) -> integer()

Types:

String = string()
Base = 2..36
Returns an integer whose text representation in base Base is String.

原文地址:https://www.cnblogs.com/moniza/p/3896375.html