Skip to content

Commit

Permalink
style: use snake_case to keep it consistent with the other code
Browse files Browse the repository at this point in the history
  • Loading branch information
CAIMEOX authored and Yoorkin committed Mar 11, 2024
1 parent a333743 commit 0ede2ca
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions list/list.mbt
Original file line number Diff line number Diff line change
Expand Up @@ -690,15 +690,15 @@ pub fn take[T](self : List[T], n : Int) -> List[T] {
if n <= 0 {
Nil
} else {
unsafeTake(n, self)
unsafe_take(n, self)
}
}

fn unsafeTake[T](n : Int, xs : List[T]) -> List[T] {
fn unsafe_take[T](n : Int, xs : List[T]) -> List[T] {
match (n, xs) {
(0, _) => Nil
(1, Cons(x, _)) => Cons(x, Nil)
(_, Cons(x, xs)) => Cons(x, unsafeTake(n - 1, xs))
(_, Cons(x, xs)) => Cons(x, unsafe_take(n - 1, xs))
_ => abort("take: index out of bounds")
}
}
Expand All @@ -719,15 +719,15 @@ pub fn drop[T](self : List[T], n : Int) -> List[T] {
if n <= 0 {
self
} else {
unsafeDrop(n, self)
unsafe_drop(n, self)
}
}

fn unsafeDrop[T](n : Int, xs : List[T]) -> List[T] {
fn unsafe_drop[T](n : Int, xs : List[T]) -> List[T] {
match (n, xs) {
(0, _) => xs
(1, Cons(_, xs)) => xs
(_, Cons(_, xs)) => unsafeDrop(n - 1, xs)
(_, Cons(_, xs)) => unsafe_drop(n - 1, xs)
_ => abort("drop: index out of bounds")
}
}
Expand Down

0 comments on commit 0ede2ca

Please sign in to comment.