Functional Tendencies
While supporting all of the object-oriented features available in Java (and in fact, augmenting them in various ways), Scala also provides a large number of capabilities that are normally found only in functional programming languages. Together, these features allow Scala programs to be written in an almost completely functional style, and also allow functional and object-oriented styles to be mixed.
Examples are:
- No distinction between statements and expressions
- Type inference
- Anonymous functions with capturing semantics (i.e. closures)
- Immutable variables and objects
- Lazy evaluation
- Delimited continuations (since 2.8)
- higher-order functions
- nested functions
- currying
- pattern matching
- algebraic data types (through "case classes")
- tuples
Read more about this topic: Scala (programming Language), Features (with Reference To Java)
Famous quotes containing the words functional and/or tendencies:
“Stay-at-home mothers, . . . their self-esteem constantly assaulted, . . . are ever more fervently concerned that their offspring turn out better so they wont have to stoop to say I told you so. Working mothers, . . . their self-esteem corroded by guilt, . . . are praying their kids turn out functional so they can stop being defensive and apologetic and instead assert See? I did do it all.”
—Melinda M. Marshall (20th century)
“Hence it will not do for the Landlord to possess too fine a nature.... He must have no idiosyncracies, no particular bents or tendencies to this or that, but a general, uniform, and healthy development, such as his portly person indicates, offering himself equally on all sides to men.”
—Henry David Thoreau (18171862)