concept string in category clojure

This is an excerpt from Manning's book Clojure: The Essential Reference.
The standard library content can be roughly categorized by looking at the major features Clojure introduces and by the most common programming tasks. There are, for example, big groups of functions dedicated to Software Transactional Memory [9], concurrency and persistent collections. Of course Clojure also adds all the necessary support for common tasks like IO, sequence processing, math operations, XML, strings and many others. Apparently missing from the Clojure standard library are solutions already provided by the Java SDK, for example cryptography, low-level networking, HTTP, 2D graphics and so on. For all practical purposes those features are not missing, but just usable as they are from Java without the need to re-write them in Clojure. Java interoperability is one of the big strength of Clojure, opening the possibility to easily use the Java SDK (Standard Development Kit) from a Clojure program.
If the portion of the string we need to extract is not fixed, we can use a regular expression with
s/split:(def errors ; #1 ["String is out of bound: 34" "48 is not a valid index." "Position 3 is out of bound."]) (map #(peek (s/split % #"\D+")) errors) ; #2 ;; ("34" "48" "3")

This is an excerpt from Manning's book Get Programming with Clojure.
In ruby, strings are mutable and in Java, StringBuffers are mutable. It means that their contents can be modified by a program at run time.
In Clojure it is impossible for a program to modify the content of a string.
The value of the variable is not modified by str. The reason is that in Clojure, strings are immutable. It means that they never change.
KEY POINT
In Clojure, strings are immutable: they never change.
The cool thing with str is that we can mix strings and non-string arguments: str automatically stringifies non-string arguments and concatenates the resulting strings. For instance, let’s create a string made of the number of beers John drank:
user=> (def num-of-beers 2) 2 user=> (str "John drank " num-of-beers " beers.") "John drank 2 beers."
KEY POINT
In a str expression, we can mix strings and non-string arguments: str automatically stringifies non-string arguments and concatenates the resulting strings.
All the pieces are in place to write the hello-young function that receives a name and an age and returns a string that contains the name and the age, like this:
The circle can also be traversed starting from the string "42" and applying to it read-string and then str:
user=> (str (read-string "42")) "42"Fig 15.1 - string to data conversion circle read-string is the reciprocal function of str, in the sense that it works like str but in the other direction: str converts data into string while read-string converts string into data. For instance, (str 42.3) is "42.3" and (read-string "42.3") is 42.3.
![]()

This is an excerpt from Manning's book Clojure in Action, Second Edition.
The minimum requirement to be a functional language is to treat functions as something more than named subroutines for executing blocks of code. Functions in an FP language are values, just like the string "hello" and the number 42 are values. You can pass functions as arguments to other functions, and functions can return functions as output values. If a programming language can treat a function as a value, it’s often said to have “first-class” functions. All of this may sound either impossible or too abstract at this point, so just keep in mind that you’re going to see functions used in new, interesting ways in the code examples later in this chapter.
In this section, you’ll develop some code in a test-first manner. The first example is a set of functions that help with strings that represent dates. Specifically, you’ll write functions to increment and decrement such date strings. Such operations are often needed in many applications, so this functionality may prove useful as a utility. Although this example is simple, it illustrates the technique of writing unit tests and then getting them to pass, while also using the REPL to make the process quicker.
(deftest test-as-string (let [d (date "2009-01-22")] (is (= (as-string d) "2009-01-22"))))Because you have functions to get the day, month, and year from a given date object, it’s trivial to write a function that constructs a string containing words separated by dashes. Here’s the implementation, which will compile and run after you include clojure.string in the namespace via a require clause:
(require '[clojure.string :as str]) (defn as-string [date] (let [y (year-from date) m (month-from date) d (day-from date)] (str/join "-" [y m d])))