Skip to content

Commit bdca920

Browse files
committed
Added an example to the to_list function
Since `Dict.into_list(Enum.into(list, dict_impl.new)) == list`, I used Dict.put to build the dict.
1 parent b108847 commit bdca920

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lib/elixir/lib/dict.ex

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -872,6 +872,13 @@ defmodule Dict do
872872
@doc """
873873
Returns a list of key-value pairs stored in `dict`.
874874
No particular order is enforced.
875+
876+
## Examples
877+
878+
iex> dict = dict_impl.new
879+
iex> dict = Dict.put(dict, :a, 1)
880+
iex> Dict.to_list(dict)
881+
[a: 1]
875882
"""
876883
@spec to_list(t) :: list
877884
def to_list(dict) do

0 commit comments

Comments
 (0)