Book contents
- Frontmatter
- Contents
- Preface
- 1 Introduction
- 2 Core features
- 3 Advanced features
- 4 Parser builders
- 5 XML processing
- 6 GUI programming
- 7 Concurrent programming
- 8 On paths and a bit of algebraic abstraction
- 9 Virtual files coming into existence
- 10 Compositional file matching
- 11 Searching, iterating, traversing
- 12 The expression problem
- 13 A computer algebra system
- Appendix A Multimedia processing
- Appendix B Distributing a Scala application along with Scala itself
- Appendix C Working with the compiler and the interpreter
- Appendix D Scala's grammar
- References
- Name index
- Subject index
3 - Advanced features
Published online by Cambridge University Press: 05 June 2012
- Frontmatter
- Contents
- Preface
- 1 Introduction
- 2 Core features
- 3 Advanced features
- 4 Parser builders
- 5 XML processing
- 6 GUI programming
- 7 Concurrent programming
- 8 On paths and a bit of algebraic abstraction
- 9 Virtual files coming into existence
- 10 Compositional file matching
- 11 Searching, iterating, traversing
- 12 The expression problem
- 13 A computer algebra system
- Appendix A Multimedia processing
- Appendix B Distributing a Scala application along with Scala itself
- Appendix C Working with the compiler and the interpreter
- Appendix D Scala's grammar
- References
- Name index
- Subject index
Summary
The constructs that have been presented in the previous chapter are enough for the creation of simple software systems. On the other hand, it is quite possible to create very complex software systems with these constructs, but the design and implementation processes will be really difficult. Fortunately, Scala provides many advanced features and constructs that facilitate programming as a mental activity. In this chapter we will describe most of these advanced features, while a few others like parsing combinators and actors will be presented thoroughly in later chapters.
Playing with trees
In the previous chapter we presented many important data types, but we did not mention trees, which forma group of data types that have many uses. Also, from the discussion so far, it is not clear whether Scala provides a facility for the construction of recursive data types, that is data types that are defined in terms of themselves. For example, a binary tree is a typical example of a recursively defined data structure that can be defined as follows.
Definition 1 Given the type node, a binary tree over the type node is defined in the following way.
- Type
- Chapter
- Information
- Steps in ScalaAn Introduction to Object-Functional Programming, pp. 95 - 170Publisher: Cambridge University PressPrint publication year: 2010