Chapter 6. Surveying the Landscape

So far, this book has been driven by the problem domain, pulling in Clojure's features as we need to solve a specific problem. The purpose of this chapter is to step back and review all of Clojure's features together. We'll review Clojure's scalars, collection types, and composite data types again. Then, we'll take a look at how to use Clojure's functions to access, update, and compose data structures.

We'll look at I/O operations and ways to approach what are called side effects. We'll also touch on Clojure's options when dealing with concurrency and parallelism and gain an understanding of the difference between the two. We'll then take our accumulated Clojure knowledge and compare it to similar computation models offered by object-oriented and strongly typed functional programming systems using Java and Haskell, respectively. This will be a good opportunity to gain a basic understanding of type systems, how they apply to Clojure, Java, and Haskell, and the implications of each computation model. The topics that we'll cover in this chapter are as follows:

  • Scalar data types
  • Numbers and precision
  • A review of collections
  • Data transformation patterns and principles
  • Clojure's model of state and identity
  • Introducing side-effects
  • Concurrency and parallelism
  • Type systems
  • Comparing Clojure with object orientation
  • Comparing Clojure with FP and strong typing

Scalar data types

Scalar data types are those that contain one value at a time, as opposed to collections of composite data types. A scalar can be in the form of a nil, boolean, number, string, character, regular expression, keyword, or symbol. The following program elements are all scalar in nature and can be directly evaluated in your REPL:

nil
true
4
2.3
567/11
"hello"

#"^hellod?world$"
:hello
'hello
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.138.37.191