Gregofi / mjolnir

Functional programming language without exotic syntax, written in Rust.
2 stars 0 forks source link

Stack overflow when saving result to variable #23

Closed Gregofi closed 3 months ago

Gregofi commented 3 months ago

The following implementation of filter on List causes SO:

    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(),
    }
Gregofi commented 3 months ago

Solved in the #24