In Functional Programming
Functional programming languages often discourage or don't support explicit in-place algorithms that overwrite data, since this is a type of side effect; instead, they only allow new data to be constructed. However, good functional language compilers will often recognize when an object very similar to an existing one is created and then the old one thrown away, and will optimize this into a simple mutation "under-the-hood".
Note that it is possible in principle to carefully construct in-place algorithms that don't modify data (unless the data is no longer being used), but this is rarely done in practice. See purely functional data structures.
Read more about this topic: In-place Algorithm
Famous quotes containing the words functional and/or programming:
“Well designed, fully functional infant. Provides someone to live for as well as another mouth to feed. Produces cooing, gurgling and other adorable sounds. May cause similar behavior in nearby adults. Cries when hungry, sleepy or just because. Hand Wash with warm water and mild soap, then pat dry with soft cloth and talc. Internal mechanisms are self-cleaning... Two Genders: Male. Female. Five Colors: White. Black. Yellow. Red. Camouflage.”
—Alfred Gingold, U.S. humorist. Items From Our Catalogue, Baby, Avon Books (1982)
“If there is a price to pay for the privilege of spending the early years of child rearing in the drivers seat, it is our reluctance, our inability, to tolerate being demoted to the backseat. Spurred by our success in programming our children during the preschool years, we may find it difficult to forgo in later states the level of control that once afforded us so much satisfaction.”
—Melinda M. Marshall (20th century)