From 34d4bf1055b8cc9d5f281a07e9f5fa56c6bed5c0 Mon Sep 17 00:00:00 2001 From: Gareth Pendleton Date: Fri, 17 Oct 2025 23:29:32 +0100 Subject: [PATCH] fix: Reordered to_list_loop parameter order --- src/dllist.gleam | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/dllist.gleam b/src/dllist.gleam index 83554e4..71be07b 100644 --- a/src/dllist.gleam +++ b/src/dllist.gleam @@ -237,18 +237,18 @@ pub fn to_list(list: DLList(a)) -> List(a) { True -> [] False -> { let assert Ok(a) = get(list) - [a, ..to_list_loop(list.current, do_move_right(list))] + [a, ..to_list_loop(do_move_right(list), list.current)] } } } -fn to_list_loop(ref: Int, list: Result(DLList(a), Nil)) -> List(a) { +fn to_list_loop(list: Result(DLList(a), Nil), start_ref: Int) -> List(a) { case list { Error(_) -> [] - Ok(DLList(_, current, _)) if current == ref -> [] + Ok(DLList(_, current, _)) if current == start_ref -> [] Ok(list) -> { let assert Ok(a) = get(list) - [a, ..to_list_loop(ref, do_move_right(list))] + [a, ..to_list_loop(do_move_right(list), start_ref)] } } }