Skip to content

Commit 1c72223

Browse files
yoshielpil
authored andcommitted
convert from use
1 parent 2d3daf4 commit 1c72223

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/gleam/dict.gleam

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,7 @@ pub fn is_empty(dict: Dict(k, v)) -> Bool {
9696
///
9797
@external(erlang, "maps", "to_list")
9898
pub fn to_list(dict: Dict(k, v)) -> List(#(k, v)) {
99-
use acc, key, value <- fold(dict, from: [])
100-
[#(key, value), ..acc]
99+
fold(dict, from: [], with: fn(acc, key, value) { [#(key, value), ..acc] })
101100
}
102101

103102
/// Converts a list of 2-element tuples `#(key, value)` to a dict.
@@ -232,8 +231,7 @@ fn do_map_values(f: fn(k, v) -> a, dict: Dict(k, v)) -> Dict(k, a)
232231
///
233232
@external(erlang, "maps", "keys")
234233
pub fn keys(dict: Dict(k, v)) -> List(k) {
235-
use acc, key, _value <- fold(dict, [])
236-
[key, ..acc]
234+
fold(dict, [], fn(acc, key, _value) { [key, ..acc] })
237235
}
238236

239237
/// Gets a list of all values in a given dict.
@@ -251,8 +249,7 @@ pub fn keys(dict: Dict(k, v)) -> List(k) {
251249
///
252250
@external(erlang, "maps", "values")
253251
pub fn values(dict: Dict(k, v)) -> List(v) {
254-
use acc, _key, value <- fold(dict, [])
255-
[value, ..acc]
252+
fold(dict, [], fn(acc, _key, value) { [value, ..acc] })
256253
}
257254

258255
/// Creates a new dict from a given dict, minus any entries that a given function

0 commit comments

Comments
 (0)