English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
反转元素列表。
reverse(lst)
Lst −需要反转的元素列表。
返回元素的反向列表。
-module(helloworld). -import(lists,[reverse/1]). -export([start/0]). start() -> Lst1 = [1,2,3], io:fwrite("~p~n",[reverse(Lst1)]).
当我们运行上面的程序时,我们将得到以下结果。
[3,2,1]