Skip to content

groupsOf and friends can exceed maximum call stack size #164

@jmbromley

Description

@jmbromley

groupsOf and friends are not truly tail recursive because they use List.take from elm/core. But the core implementation of List.take only switches to a (slightly slower) tail recursive implementation after it has processed 1000 elements. This means that if groupsOf has a large number of recursions then it can build up an excessive call stack from repeated calls to List.take (each of which could have a stack of up to 1000 calls).

A realword of example of this causing "maximum call stack size exceeded" errors is billstclair/elm-crypto-string#10.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions