We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
list.range
1 parent a5519c3 commit 8ab8308Copy full SHA for 8ab8308
src/gleam/list.gleam
@@ -1289,9 +1289,9 @@ pub fn range(from start: Int, to stop: Int) -> List(Int) {
1289
1290
fn tail_recursive_range(start: Int, stop: Int, acc: List(Int)) -> List(Int) {
1291
case int.compare(start, stop) {
1292
- order.Eq -> reverse([stop, ..acc])
1293
- order.Gt -> tail_recursive_range(start - 1, stop, [start, ..acc])
1294
- order.Lt -> tail_recursive_range(start + 1, stop, [start, ..acc])
+ order.Eq -> [stop, ..acc]
+ order.Gt -> tail_recursive_range(start, stop + 1, [stop, ..acc])
+ order.Lt -> tail_recursive_range(start, stop - 1, [stop, ..acc])
1295
}
1296
1297
0 commit comments