Nicht aus der Schweiz? Besuchen Sie lehmanns.de
Clojure Cookbook - Luke VanderHart, Ryan Neufeld

Clojure Cookbook

Recipes for Functional Programming
Buch | Softcover
476 Seiten
2014
O'Reilly Media (Verlag)
978-1-4493-6617-9 (ISBN)
CHF 56,50 inkl. MwSt
With more than 150 detailed recipes, this cookbook shows experienced Clojure developers how to solve a variety of programming tasks with this JVM language. The solutions cover everything from building dynamic websites and working with databases to network communication, cloud computing, and advanced testing strategies. And more than 60 of the world’s best Clojurians contributed recipes.

Each recipe includes code that you can use right away, along with a discussion on how and why the solution works, so you can adapt these patterns, approaches, and techniques to situations not specifically covered in this cookbook.
  • Master built-in primitive and composite data structures
  • Create, develop and publish libraries, using the Leiningen tool
  • Interact with the local computer that’s running your application
  • Manage network communication protocols and libraries
  • Use techniques for connecting to and using a variety of databases
  • Build and maintain dynamic websites, using the Ring HTTP server library
  • Tackle application tasks such as packaging, distributing, profiling, and logging
  • Take on cloud computing and heavyweight distributed data crunching
  • Dive into unit, integration, simulation, and property-based testing

»Clojure Cookbook« is a collaborative project with contributions from some of the world’s best Clojurians, whose backgrounds range from aerospace to social media, banking to robotics, AI research to e-commerce.

Luke VanderHart is a Clojure/ClojureScript developer, a member of Clojure/core, and a co-author of Practical Clojure (Apress, 2010). Luke lives in Maryland. Ryan Neufeld is an experienced software developer with Relevance, Inc. Although a first-time author, Ryan has worked at a number of established startups.

Chapter 1 Primitive Data
Introduction
Changing the Capitalization of a String
Cleaning Up Whitespace in a String
Building a String from Parts
Treating a String as a Sequence of Characters
Converting Between Characters and Integers
Formatting Strings
Searching a String by Pattern
Pulling Values Out of a String Using Regular Expressions
Performing Find and Replace on Strings
Splitting a String into Parts
Pluralizing Strings Based on a Quantity
Converting Between Strings, Symbols, and Keywords
Maintaining Accuracy with Extremely Large/Small Numbers
Working with Rational Numbers
Parsing Numbers
Truncating and Rounding Numbers
Performing Fuzzy Comparison
Performing Trigonometry
Inputting and Outputting Integers with Different Bases
Calculating Statistics on Collections of Numbers
Performing Bitwise Operations
Generating Random Numbers
Working with Currency
Generating Unique IDs
Obtaining the Current Date and Time
Representing Dates as Literals
Parsing Dates and Times Using clj-time
Formatting Dates Using clj-time
Comparing Dates
Calculating the Length of a Time Interval
Generating Ranges of Dates and Times
Generating Ranges of Dates and Times Using Native Java Types
Retrieving Dates Relative to One Another
Working with Time Zones
Converting a Unix Timestamp to a Date
Converting a Date to a Unix Timestamp
Chapter 2 Composite Data
Introduction
Creating a List
Creating a List from an Existing Data Structure
"Adding" an Item to a List
"Removing" an Item from a List
Testing for a List
Creating a Vector
"Adding" an Item to a Vector
"Removing" an Item from a Vector
Getting the Value at an Index
Setting the Value at an Index
Creating a Set
Adding and Removing Items from Sets
Testing Set Membership
Using Set Operations
Creating a Map
Retrieving Values from a Map
Retrieving Multiple Keys from a Map Simultaneously
Setting Keys in a Map
Using Composite Values as Map Keys
Treating Maps as Sequences (and Vice Versa)
Applying Functions to Maps
Keeping Multiple Values for a Key
Combining Maps
Comparing and Sorting Values
Removing Duplicate Elements from a Collection
Determining if a Collection Holds One of Several Values
Implementing Custom Data Structures: Red-Black Trees—Part I
Implementing Custom Data Structures: Red-Black Trees—Part II
Chapter 3 General Computing
Introduction
Running a Minimal Clojure REPL
Interactive Documentation
Exploring Namespaces
Trying a Library Without Explicit Dependencies
Running Clojure Programs
Running Programs from the Command Line
Parsing Command-Line Arguments
Creating Custom Project Templates
Building Functions with Polymorphic Behavior
Extending a Built-In Type
Decoupling Consumers and Producers with core.async
Making a Parser for Clojure Expressions Using core.match
Querying Hierarchical Graphs with core.logic
Playing a Nursery Rhyme
Chapter 4 Local I/O
Introduction
Writing to STDOUT and STDERR
Reading a Single Keystroke from the Console
Executing System Commands
Accessing Resource Files
Copying Files
Deleting Files or Directories
Listing Files in a Directory
Memory Mapping a File
Reading and Writing Text Files
Using Temporary Files
Reading and Writing Files at Arbitrary Positions
Parallelizing File Processing
Parallelizing File Processing with Reducers
Reading and Writing Clojure Data
Using edn for Configuration Files
Emitting Records as edn Values
Handling Unknown Tagged Literals When Reading Clojure Data
Reading Properties from a File
Reading and Writing Binary Files
Reading and Writing CSV Data
Reading and Writing Compressed Files
Working with XML Data
Reading and Writing JSON Data
Generating PDF Files
Making a GUI Window with Scrollable Text
Chapter 5 Network I/O and Web Services
Introduction
Making HTTP Requests
Performing Asynchronous HTTP Requests
Sending a Ping Request
Retrieving and Parsing RSS Data
Sending Email
Communicating over Queues Using RabbitMQ
Communicating with Embedded Devices via MQTT
Using ZeroMQ Concurrently
Creating a TCP Client
Creating a TCP Server
Sending and Receiving UDP Packets
Chapter 6 Databases
Introduction
Connecting to an SQL Database
Connecting to an SQL Database with a Connection Pool
Manipulating an SQL Database
Simplifying SQL with Korma
Performing Full-Text Search with Lucene
Indexing Data with ElasticSearch
Working with Cassandra
Working with MongoDB
Working with Redis
Connecting to a Datomic Database
Defining a Schema for a Datomic Database
Writing Data to Datomic
Removing Data from a Datomic Database
Trying Datomic Transactions Without Committing Them
Traversing Datomic Indexes
Chapter 7 Web Applications
Introduction
Introduction to Ring
Using Ring Middleware
Serving Static Files with Ring
Handling Form Data with Ring
Handling Cookies with Ring
Storing Sessions with Ring
Reading and Writing Request and Response Headers in Ring
Routing Requests with Compojure
Performing HTTP Redirects with Ring
Building a RESTful Application with Liberator
Templating HTML with Enlive
Templating with Selmer
Templating with Hiccup
Rendering Markdown Documents
Building Applications with Luminus
Chapter 8 Performance and Production
Introduction
AOT Compilation
Packaging a Project into a JAR File
Creating a WAR File
Running an Application as a Daemon
Alleviating Performance Problems with Type Hinting
Fast Math with Primitive Java Arrays
Simple Profiling with Timbre
Logging with Timbre
Releasing a Library to Clojars
Using Macros to Simplify API Deprecations
Chapter 9 Distributed Computation
Introduction
Building an Activity Feed System with Storm
Processing Data with an Extract Transform Load (ETL) Pipeline
Aggregating Large Files
Testing Cascalog Workflows
Checkpointing Cascalog Jobs
Explaining a Cascalog Query
Running a Cascalog Job on Elastic MapReduce
Chapter 10 Testing
Introduction
Unit Testing
Testing with Midje
Thoroughly Testing by Randomizing Inputs
Finding Values That Cause Failure
Running Browser-Based Tests
Tracing Code Execution
Avoiding Null-Pointer Exceptions with core.typed
Verifying Java Interop Using core.typed
Type Checking Higher-Order Functions with core.typed

Index
Colophon

Erscheint lt. Verlag 22.4.2014
Verlagsort Sebastopol
Sprache englisch
Maße 178 x 233 mm
Gewicht 780 g
Einbandart kartoniert
Themenwelt Informatik Programmiersprachen / -werkzeuge Eclipse
Informatik Programmiersprachen / -werkzeuge Java
Mathematik / Informatik Informatik Software Entwicklung
ISBN-10 1-4493-6617-1 / 1449366171
ISBN-13 978-1-4493-6617-9 / 9781449366179
Zustand Neuware
Haben Sie eine Frage zum Produkt?
Mehr entdecken
aus dem Bereich
Kennenlernen. Verstehen. Effizient nutzen.

von Thomas Künneth

Buch (2018)
Hanser, Carl (Verlag)
CHF 54,60