リストのN番目の要素を返します。
nth(N,List)
リストのN ^ th ^要素を返します。
-module(helloworld). -import(lists,[nth/2]). -export([start/0]). start() -> Lst1 = [1,2,3], io:fwrite("~p~n",[nth(2,Lst1)]).
上記のプログラムを実行すると、次の結果が得られます。
2