diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gleam/list.gleam | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/gleam/list.gleam b/src/gleam/list.gleam index d495dda..3b7aebe 100644 --- a/src/gleam/list.gleam +++ b/src/gleam/list.gleam @@ -22,11 +22,11 @@ //// ``` //// -import gleam/int +import gleam/dict.{type Dict} import gleam/float +import gleam/int import gleam/order.{type Order} import gleam/pair -import gleam/dict.{type Dict} /// Counts the number of elements in a given list. /// @@ -1115,6 +1115,12 @@ pub fn intersperse(list: List(a), with elem: a) -> List(a) { /// // -> Error(Nil) /// ``` /// +@deprecated(" + +Gleam lists are immutable linked lists, so indexing into them is a slow operation that must traverse the list. + +In functional programming it is very rare to use indexing, so if you are using indexing then a different algorithm or a different data structure is likely more appropriate. +") pub fn at(in list: List(a), get index: Int) -> Result(a, Nil) { case index >= 0 { True -> |