From 66e81a8b37137c558e4270f2ce026a2c1da0c17a Mon Sep 17 00:00:00 2001 From: Rongjian Zhang Date: Mon, 11 Mar 2024 20:06:51 +0800 Subject: [PATCH] fix: tuple with some --- list/list.mbt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/list/list.mbt b/list/list.mbt index d88e0115b..651f7987f 100644 --- a/list/list.mbt +++ b/list/list.mbt @@ -669,13 +669,13 @@ pub fn unfold[T, State]( f : (State) -> Option[(T, State)] ) -> List[T] { match f(init) { - Some(element, new_state) => Cons(element, unfold(new_state, f)) + Some((element, new_state)) => Cons(element, unfold(new_state, f)) None => Nil } } test "unfold" { - let ls = unfold(0, fn { i => if i == 3 { None } else { Some(i, i + 1) } }) + let ls = unfold(0, fn { i => if i == 3 { None } else { Some((i, i + 1)) } }) @assertion.assert_eq(ls, Cons(0, Cons(1, Cons(2, Nil))))? }