stdlib icon indicating copy to clipboard operation
stdlib copied to clipboard

Iterator try_fold will exceed call stack size in javascript target

Open pendletong opened this issue 5 months ago • 0 comments

Running the following on the Gleam language tour results in 'too much recursion' error

`import gleam/iterator

pub fn main() { iterator.range(1,6000) |> iterator.try_fold(0, fn(acc, i) { Ok(acc+i) }) } `

Changing to use list.range and list.try_fold works, presumably because list.try_fold is tail recursive unlike iterator.try_fold

pendletong avatar Sep 02 '24 12:09 pendletong