Closed Gregofi closed 3 months ago
The following implementation of filter on List causes SO:
filter
List
fn filter(fun: (T) => Bool): List[T] = match self { Cons(head, tail) => { let result = tail.filter(fun); if fun(head) { Cons(head, tail.filter(fun)) } else { result } }, Nil => Nil(), }
Solved in the #24
The following implementation of
filter
onList
causes SO: