concept term in category clojure

appears as: terms, term, term, terms, A term
Clojure: The Essential Reference

This is an excerpt from Manning's book Clojure: The Essential Reference.

The expressiveness of a language is often described as the speed at which ideas can be translated into working software. Part of the expressiveness comes from the language itself in terms of syntax, but another fundamental part comes from the standard library which is usually provided out of the box. A good standard library liberates the programmer from the most mundane tasks like connecting to data sources, parsing XML, dealing with numbers and a lot more. When the standard library does a good job, developers are free to concentrate on core business aspects of an application, boosting productivity and return of investment.

  • iterate is a flexible form of repetition to generate a lazy sequence with a function that decides the next item based on the previous. repeat, for instance, can be written in terms of iterate as: (iterate identity x).
  • The Joy of Clojure, Second Edition

    This is an excerpt from Manning's book The Joy of Clojure, Second Edition.

    In this chapter, we’ll discuss the weaknesses in existing languages that Clojure was designed to address, how it provides strength in those areas, and many of the design decisions Clojure embodies. We’ll also look at some of the ways existing languages have influenced Clojure, and define many of the terms used throughout the book. We assume some familiarity with Clojure, although if you feel like you’re getting lost, jumping to chapter 2 for a quick language tutorial will help. This chapter only scratches the surface of the topics that we’ll cover in this book, but it serves as a nice basis for understanding not only the “how” of Clojure, but also the “why.”

    The first important term to define is time. Simply put, time refers to the relative moments when events occur. Over time, the properties associated with an entity—both static and changing, singular or composite—will form a concrescence (Whitehead 1929), or, in other words, its identity. It follows that at any given time, a snapshot can be taken of an entity’s properties, defining its state. This notion of state is an immutable one because it’s not defined as a mutation in the entity itself, but only as a manifestation of its properties at a given moment in time. Imagine a child’s flip book, as shown in figure 1.7, to understand the terms fully.

    Figure 1.7. The Runner. A child’s flip book serves to illustrate Clojure’s notions of state, time, and identity. The book itself represents the identity. Whenever you wish to show a change in the illustration, you draw another picture and add it to the end of your flip book. The act of flipping the pages therefore represents the states over time of the image within. Stopping at any given page and observing the particular picture represents the state of the Runner at that moment in time.

    It’s important to note that in the canon of object-oriented programming (OOP), there’s no clear distinction between state and identity. In other words, these two ideas are conflated into what’s commonly referred to as mutable state. The classical object-oriented model allows unrestrained mutation of object properties without a willingness to preserve historical states. Clojure’s implementation attempts to draw a clear separation between an object’s state and identity as they relate to time. To state the difference from Clojure’s model in terms of the aforementioned flip book, the mutable state model is different, as shown in figure 1.8.

    Listing 10.7. Simple SafeArray protocol
    (ns joy.locks   (:refer-clojure :exclude [aget aset count seq]) #1   (:require [clojure.core :as clj])   (:use [joy.mutation :only (dothreads!)])) (defprotocol SafeArray #2   (aset  [this i f]) #3   (aget  [this i]) #4   (count [this])   (seq   [this])) (defn make-dumb-array [t sz]   (let [a (make-array t sz)]     (reify       SafeArray       (count [_]   (clj/count a))       (seq   [_]   (clj/seq a))       (aget  [_ i] (clj/aget a i)) #5       (aset  [this i f]         (clj/aset a #6                   i                   (f (aget this i))))))) #7 #1 - Exclude Clojure core functions to override #2 - SafeArray features a small set of functions #3 - Change the standard semantics of clojure.core/aset and clojure.core/aget #4 - aget and aset are unguarded #5 - aget and aset are unguarded #6 - Delegate to core for setting #7 - Implement SafeArray/aset in terms of clojure.core/aset !@%STYLE%@! {"css":"{\"css\": \"font-weight: bold;\"}","target":"[]"} !@%STYLE%@!