-module(helloworld).
-export([start/0]).
start() ->
Aabs = abs(-3.14),
io:fwrite("~p~n",[Aabs]).
-module(helloworld).
-import(math,[log/1]).
-export([start/0]).
start() ->
Alog = log(3.14),
io:fwrite("~p~n",[Alog]).
-module(helloworld).
-import(math,[exp/1]).
-export([start/0]).
start() ->
Aexp = exp(3.14),
io:fwrite("~p~n",[Aexp]).
-module(helloworld).
-import(math,[atan/1]).
-export([start/0]).
start() ->
Atan = atan(0.7071),
io:fwrite("~p~n",[Atan]).
-module(helloworld).
-import(math,[acos/1]).
-export([start/0]).
start() ->
Acos = acos(0.7071),
io:fwrite("~p~n",[Acos]).
-module(helloworld).
-import(math,[asin/1]).
-export([start/0]).
start() ->
Asin = asin(0.7071),
io:fwrite("~p~n",[Asin]).
-module(helloworld).
-import(math,[tan/1]).
-export([start/0]).
start() ->
Tan = tan(45),
io:fwrite("~p~n",[Tan]).
-module(helloworld).
-import(math,[cos/1]).
-export([start/0]).
start() ->
Cosin = cos(45),
io:fwrite("~p~n",[Cosin]).
-module(helloworld).
-import(math,[sin/1]).
-export([start/0]).
start() ->
Sin = sin(45),
io:fwrite("~p~n",[Sin]).
-module(helloworld).
-export([start/0]).
start() ->
io:fwrite("~f~n",[1.1+1.2]),
io:fwrite("~e~n",[1.1+1.2]).
% Erlang浮点数
-module(helloworld).
-export([start/0]).
start() ->
io:fwrite("~w",[1.1+1.2]).
-module(helloworld).
-import(lists,[last/1]).
-export([start/0]).
start() ->
Lst1=[1,2,3,4],
io:fwrite("~w~n",[last(Lst1)]).
-module(helloworld).
-import(lists,[duplicate/2]).
-export([start/0]).
start() ->
Lst1 = duplicate(5,1),
-module(helloworld).
-import(lists,[droplast/1]).
-export([start/0]).
start() ->
Lst1 = [1,2,3],
Lst2 = droplast(Lst1),
-module(helloworld).
-import(lists,[delete/2]).
-export([start/0]).
start() ->
Lst1 = [1,2,3],
Lst2 = delete(2,Lst1),
-module(helloworld).
-import(lists,[append/2]).
-export([start/0]).
start() ->
Lst1 = [1,2,3],
Lst2 = append(Lst1,[4,5]),
-module(helloworld).
-import(lists,[any/2]).
-export([start/0]).
start() ->
Lst1 = [1,2,3],
Predicate = fun(E) -> E rem 2 == 0 end,
-module(helloworld).
-import(lists,[all/2]).
-export([start/0]).
start() ->
Lst1 = [1,2,3],
Predicate = fun(E) -> E rem 2 == 0 end,
-module(helloworld).
-export([start/0]).
start() ->
Lst1 = [1,2,3],
io:fwrite("~w~n",[Lst1]).
-module(helloworld).
-import(string,[sub_string/3]).
-export([start/0]).
start() ->
Str1 = "hello world",
-module(helloworld).
-import(string,[to_upper/1]).
-export([start/0]).
start() ->
Str1 = "hello world",
% Erlang to_lower转为小写函数
-module(helloworld).
-import(string,[to_lower/1]).
-export([start/0]).
-module(helloworld).
-import(string,[right/3]).
-export([start/0]).
start() ->
Str1 = "hello",
-module(helloworld).
-import(string,[right/2]).
-export([start/0]).
start() ->
Str1 = "hello World",
-module(helloworld).
-import(string,[left/3]).
-export([start/0]).
start() ->
Str1 = "hello",
-module(helloworld).
-import(string,[left/2]).
-export([start/0]).
start() ->
Str1 = "hello World",
-module(helloworld).
-import(string,[substr/3]).
-export([start/0]).
start() ->
Str1 = "hello World",
-module(helloworld).
-import(string,[str/2]).
-export([start/0]).
start() ->
Str1 = "hello World",
-module(helloworld).
-import(string,[chr/2]).
-export([start/0]).
start() ->
Str1 = "hello World",
-module(helloworld).
-export([start/0]).
start() ->
io:fwrite("~p~n",[binary_to_atom(<<"Erlang">>, latin1)]).