2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

草莽Erlang ── 27. lists:reverse

Last updated at Posted at 2023-01-16

口で言うより行うことがErlang習得への近道と信じています。

lists:reverse/1

reverse(リスト) -> 新しいリスト

リストの要素を逆順に並べた新しいリストを返します。

練習してみます。

> lists:reverse([1, 2, 3]).
[3,2,1]

lists:reverse/2

reverse(リスト1, リスト2) -> 新しいリスト

リスト1の要素を逆順に並べたものにリスト2が連結された新しいリストを返します。リスト2は逆順にはなりません。

練習してみます。

> lists:reverse([1, 2, 3, 4], [a, b, c]).
[4,3,2,1,a,b,c]

listsモジュールには他にもリスト処理のための関数がたくさんあります。

Elixirにも挑戦したい

闘魂ElixirシリーズとElixir Schoolがオススメです。

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?