A real-world functional programming example in Scala

Alvin Alexander. (Alvin Alexander Web Site). 2016-08-08.
Understanding functional programming concepts is one thing; putting them into practice in a real project is another. You’d like to see a real example of functional programming in Scala.
To demonstrate some of the functional programming (FP) techniques that I introduced earlier in this chapter, the following example shows one way to implement Newton’s Method, a mathematical method that can be used to solve the roots of equations.

[A real-world functional programming example in Scala ]

Scala Programming Language

Object-Oriented Meets Functional. Have the best of both worlds. Construct elegant class hierarchies for maximum code reuse and extensibility, implement their behavior using higher-order functions. Or anything in-between.
Scala is an acronym for “Scalable Language”. This means that Scala grows with you. You can play with it by typing one-line expressions and observing the results. But you can also rely on it for large mission critical systems, as many companies, including Twitter, LinkedIn, or Intel do.
To some, Scala feels like a scripting language. Its syntax is concise and low ceremony; its types get out of the way because the compiler can infer them. There’s a REPL and IDE worksheets for quick feedback. Developers like it so much that Scala won the ScriptBowl contest at the 2012 JavaOne conference.
At the same time, Scala is the preferred workhorse language for many mission critical server systems. The generated code is on a par with Java’s and its precise typing means that many problems are caught at compile-time rather than after deployment.
At the root, the language’s scalability is the result of a careful integration of object-oriented and functional language concepts.

[Scala Programming Language.]