diff options
author | Ryan M. Moore <rmm1047@gmail.com> | 2024-04-30 14:13:49 -0400 |
---|---|---|
committer | Louis Pilfold <louis@lpil.uk> | 2024-05-01 11:31:48 +0100 |
commit | bca305d766c9363ff6067be5c43ee94c8ae2e0e4 (patch) | |
tree | bd4cb34182307256c4db2ce0deb157b0c430c1e6 | |
parent | c91845d4d0e6edd46551249861eb72704ff23f5a (diff) | |
download | gleam_stdlib-bca305d766c9363ff6067be5c43ee94c8ae2e0e4.tar.gz gleam_stdlib-bca305d766c9363ff6067be5c43ee94c8ae2e0e4.zip |
Update examples for `dict.to_list`
-rw-r--r-- | src/gleam/dict.gleam | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/gleam/dict.gleam b/src/gleam/dict.gleam index 4b0f333..8b459ec 100644 --- a/src/gleam/dict.gleam +++ b/src/gleam/dict.gleam @@ -42,14 +42,19 @@ pub fn size(dict: Dict(k, v)) -> Int /// /// ## Examples /// +/// Calling `to_list` on an empty `dict` returns an empty list. +/// /// ```gleam -/// new() -/// // -> from_list([]) +/// new() |> to_list +/// // -> [] /// ``` +/// +/// The ordering of elements in the resulting list is an implementation detail +/// that should not be relied upon. /// /// ```gleam -/// new() |> insert("key", 0) -/// // -> from_list([#("key", 0)]) +/// new() |> insert("b", 1) |> insert("a", 0) |> insert("c", 2) |> to_list +/// // -> [#("a", 0), #("b", 1), #("c", 2)] /// ``` /// @external(erlang, "maps", "to_list") |