nthtail
返回List的第N个尾部,即List的子列表,从N + 1开始,一直持续到列表的末尾
语法 (Syntax)
nthtail(N, List)
参数 (Parameters)
N - 需要返回元素的尾部的第n个位置。
Lst - 元素列表。
返回值 (Return Value)
返回List的第N个尾部,即List的子列表,从N + 1开始并一直持续到列表的末尾。
例如 (For example)
-module(helloworld).
-import(lists,[nthtail/2]).
-export([start/0]).
start() ->
Lst1 = [1,2,3],
io:fwrite("~p~n",[nthtail(2,Lst1)]).
输出 (Output)
当我们运行上述程序时,我们将得到以下结果。
[3]