Working with primitive data types
In this recipe, we will review primitive data types that Clojure supports and a few functions that manipulate these types. Here, we will review the following:
- Using numbers
- Using strings and characters
- Using booleans and nil
- Using keywords and symbols
You only need REPL, as described in the previous recipe, and no additional libraries. Start REPL so that you can review the sample code of primitive types immediately in this recipe.
How to do it...
Let's start with numbers in Clojure data types.
+ function returns the sum of numbers. You can specify any number of numbers as arguments:
(+ 1 2) ;;=> 3 (+ 1 2 3) ;;=> 6 (+ 1.2 3.5) ;;=> 4.7
- function subtracts the numbers. If a single argument ...