diff options
author | Marcin Puc <marcin.e.puc@gmail.com> | 2021-10-11 22:59:55 +0200 |
---|---|---|
committer | Louis Pilfold <louis@lpil.uk> | 2021-10-12 20:54:39 +0100 |
commit | bc0653108676ed3cde624169f1b16531731a89cb (patch) | |
tree | b0091f11e6039c6f4b169f49edbf853884772c0d | |
parent | 992cb2f0d4e86827c9e9e65ec13f9d9c30dcad87 (diff) | |
download | gleam_stdlib-bc0653108676ed3cde624169f1b16531731a89cb.tar.gz gleam_stdlib-bc0653108676ed3cde624169f1b16531731a89cb.zip |
Rename list.tail to list.rest
-rw-r--r-- | src/gleam/list.gleam | 8 | ||||
-rw-r--r-- | test/gleam/list_test.gleam | 8 |
2 files changed, 8 insertions, 8 deletions
diff --git a/src/gleam/list.gleam b/src/gleam/list.gleam index e4063cd..6278c6e 100644 --- a/src/gleam/list.gleam +++ b/src/gleam/list.gleam @@ -186,16 +186,16 @@ pub fn first(list: List(a)) -> Result(a, Nil) { /// /// ## Examples /// -/// > tail([]) +/// > rest([]) /// Error(Nil) /// -/// > tail([0]) +/// > rest([0]) /// Ok([]) /// -/// > tail([1, 2]) +/// > rest([1, 2]) /// Ok([2]) /// -pub fn tail(list: List(a)) -> Result(List(a), Nil) { +pub fn rest(list: List(a)) -> Result(List(a), Nil) { case list { [] -> Error(Nil) [_, ..xs] -> Ok(xs) diff --git a/test/gleam/list_test.gleam b/test/gleam/list_test.gleam index d505ddc..b7275e4 100644 --- a/test/gleam/list_test.gleam +++ b/test/gleam/list_test.gleam @@ -57,14 +57,14 @@ pub fn first_test() { |> should.equal(Error(Nil)) } -pub fn tail_test() { - list.tail([0, 4, 5, 7]) +pub fn rest_test() { + list.rest([0, 4, 5, 7]) |> should.equal(Ok([4, 5, 7])) - list.tail([0]) + list.rest([0]) |> should.equal(Ok([])) - list.tail([]) + list.rest([]) |> should.equal(Error(Nil)) } |