This may be an oxymoron, but how would one update a data entity in the functional programming style? From all I’ve read, functional-style programming uses transformations to return an output on immutable entities. The only thing I can think of would be to completely replace the original entity, but that seems almost the same as a classic update approach.
Share
Are you talking about on disk database entities or data-structures in memory.
For the latter, functional languages use persistent data-structures, which are implemented such that the new version and the old version are both available after the update, but they share common parts (so that it is efficient). So you appear to be returning a totally new datastructure, but in fact, it shares most of its implementation with the one it was modifying.
There are some really good implementations to look at in the clojure source (written in Java) — I took two of them apart on my blog
http://www.loufranco.com/blog/files/20-Days-of-Clojure-Day-7.html
http://www.loufranco.com/blog/files/20-Days-of-Clojure-Day-8.html