Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Some algorithms require mutation to have a decent time complexity and ST allows you to implement those.

There is a tiny cost for each mutable memory location since the garbage collector has to work around then. A single array won't even be measurable, though.

Also, there are some referentially transparent algorithms that can't be implemented via ST - like laziness.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: