4 ms·
> If you have 10mb of numbers that you need to add 1 to immutable state means you now have 20mb of numbers guaranteed You'd only have 20mb of 'numbers' if you
by runT1ME 13y ago
> If you have 10mb of numbers that you need to add 1 to immutable state means you now have 20mb of numbers guaranteed
You'd only have 20mb of 'numbers' if you needed to keep a reference to the original data structure. Otherwise its' garbage.
>So in general, forced immutable state means that any class of problems which require both high performance and a lot of mutation are going to be very poor candidates for functional programming
FP does not necessitate 'immutable state', even in pure languages like Haskell. What it enforces is purity, or more concrete, referential transparency. Often the easiest way to obtain referential transparency is immutable data (non destructive data structures, etc), but you can have mutable data and maintain referential transparency for high performance (see ST Monad).