反轉(zhuǎn)元素列表。
reverse(lst)
Lst ?需要反轉(zhuǎn)的元素列表。
返回元素的反向列表。
-module(helloworld).
-import(lists,[reverse/1]).
-export([start/0]).
start() ->
Lst1 = [1,2,3],
io:fwrite("~p~n",[reverse(Lst1)]).當(dāng)我們運(yùn)行上面的程序時(shí),我們將得到以下結(jié)果。
[3,2,1]