Clojure: High Performance JVM Programming

Author: Eduardo Diaz;Shantanu Kumar;Akhil Wali  

Publisher: Packt Publishing‎

Publication year: 2017

E-ISBN: 9781787288010

P-ISBN(Paperback): 9781787129597

Subject: TP312 程序语言、算法语言

Keyword: 程序语言、算法语言,自动化技术、计算机技术

Language: ENG

Access to resources Favorite

Disclaimer: Any content in publications that violate the sovereignty, the constitution or regulations of the PRC is not accepted or approved by CNPIEC.

Description

Explore the world of lightning fast Clojure apps with asynchronous channels, logic, reactive programming, and more About This Book • Discover Clojure's features and advantages and use them in your existing projects • Explore lesser-known and more advanced features, constructs, and methodologies such as asynchronous channels, actors, logic programming, and reactive programming • Measure and monitor performance, and understand optimization techniques Who This Book Is For If you're looking to learn more about its core libraries and delve into the Clojure language in detail, then this book is ideal for you. Prior knowledge of the Clojure language is required. What You Will Learn • Understand tools for the Clojure world and how they relate to Java tools and standards (such as Maven) • Write simple multicore programs using Clojure's core concepts, such as atoms, agents, and refs • Get to grips with Clojure's concurrency and state-management primitives in depth • Analyze latency using the Criterium library • Avoid reflection and boxing with type hints • Maximize the impact of parallelization, functional composition, and process transformation by composing reducers and transducers • Modify and add features to the Clojure language using macros • Test your code with unit tests, specs, and type checks to write testable code • Troubleshoot and style your Clojure code to make it more maintainable In Detail Clojure is a general-purpose language from the Lisp family with an emphasi

Chapter

Creating a new project

Using Cursive Clojure

Getting started with Clojure code and data

Clojure's data types

Summary

Namespaces, Packages, and Tests

Namespaces in Clojure

The classpath and the classloader

Testing in Clojure

Summary

Chapter 2: Interacting with Java

Using Maven dependencies

Clojure interop syntax

Writing a simple image namespace

Writing the tests

Destructuring in Clojure

Exposing your code to Java

Proxy and reify

Summary

Chapter 4: Collections and Functional Programming

Basics of functional programming

Persistent collections

Types of collections in Clojure

The sequence abstraction

Specific collection types in Clojure

Summary

Chapter 5: Multimethods and Protocols

Polymorphism in Java

Multimethods in Clojure

Protocols in Clojure

Summary

Chapter 6: Concurrency

Using your Java knowledge

The Clojure model of state and identity

Promises

Futures

Software transactional memory and refs

Atoms

Agents

core.async

Summary

Chapter 7: Macros in Clojure

Lisp's foundational ideas

Macros as code modification tools

Writing your first macro

Debugging your first macro

Macros in the real world

References

Summary

Module 2: Clojure High Performance Programming, Second Edition

Chapter 1: Performance by Design

Use case classification

A structured approach to the performance

The performance vocabulary

The latency numbers that every programmer should know

Summary

Chapter 2: Clojure Abstractions

Non-numeric scalars and interning

Identity, value, and epochal time model

Persistent data structures

Sequences and laziness

Transducers

Transients

Performance miscellanea

Summary

Chapter 3: Leaning on Java

Inspecting the equivalent Java source for Clojure code

Numerics, boxing, and primitives

Arrays

Reflection and type hints

Using array/numeric libraries for efficiency

Resorting to Java and native code

Summary

Chapter 4: Host Performance

The hardware

The Java Virtual Machine

Measuring latency with Criterium

Summary

Chapter 5: Concurrency

Low-level concurrency

Atomic updates and state

Asynchronous agents and state

Coordinated transactional ref and state

Dynamic var binding and state

Validating and watching the reference types

Java concurrent data structures

Concurrency with threads

Clojure parallelization and the JVM

Parallelism with reducers

Summary

Chapter 6: Measuring Performance

Performance measurement and statistics

Performance testing

Performance monitoring

Profiling

Summary

Chapter 7: Performance Optimization

Project setup

Identifying performance bottlenecks

Profiling code with VisualVM

The Monitor tab

Performance tuning

Summary

Chapter 8: Application Performance

Choosing libraries

Logging

Data sizing

Resource pooling

I/O batching and throttling

Precomputing and caching

Concurrent pipelines

Applying back pressure

Performance and queueing theory

Summary

Module 3: Mastering Clojure

Chapter 1: Working with Sequences and Patterns

Defining recursive functions

Thinking in sequences

Working with pattern matching

Summary

Chapter 2: Orchestrating Concurrency and Parallelism

Managing concurrent tasks

Managing state

Executing tasks in parallel

Summary

Chapter 3: Parallelization Using Reducers

Using reduce to transform collections

Using fold to parallelize collections

Processing data with reducers

Summary

Chapter 4: Metaprogramming with Macros

Understanding the reader

Reading and evaluating code

Quoting and unquoting code

Transforming code

Summary

Chapter 5: Composing Transducers

Understanding transducers

Transducers in action

Summary

Chapter 6: Exploring Category Theory

Demystifying category theory

Using monoids

Using functors

Using applicative functors

Using monads

Summary

Chapter 7: Programming with Logic

Diving into logic programming

Thinking in logical relations

Summary

Chapter 8: Leveraging Asynchronous Tasks

Using channels

Using actors

Summary

Chapter 9: Reactive Programming

Reactive programming with fibers and dataflow variables

Using Reactive Extensions

Using functional reactive programming

Building reactive user interfaces

Introducing Om

Summary

Chapter 10: Testing Your Code

Writing tests

Testing with specs

Generative testing

Testing with types

Summary

Chapter 11: Troubleshooting and Best Practices

Debugging your code

Logging errors in your application

Thinking in Clojure

Summary

References

Bibliography

The users who browse this book also browse


No browse record.