dfinity / motoko-base

The Motoko base library
Apache License 2.0
483 stars 99 forks source link

Stack safe list operations #266

Open crusso opened 3 years ago

crusso commented 3 years ago

Many of the List operations still have naive, non-tail recursive implementations that could blow the stack. Should we fix them?

matthewhammer commented 3 years ago

I think that lists are naive, so having a naive implementation seems fine to me. Open to other positions too.

FWIW, I have been using binary trees instead:

All of that is realistic, and none of it is (or should be) supported by List.