Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Clojure Data Structures and Algorithms Cookbook

You're reading from   Clojure Data Structures and Algorithms Cookbook 25 recipes to deeply understand and implement advanced algorithms in Clojure

Arrow left icon
Product type Paperback
Published in Aug 2015
Publisher
ISBN-13 9781785281457
Length 216 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Rafik Naccache Rafik Naccache
Author Profile Icon Rafik Naccache
Rafik Naccache
Arrow right icon
View More author details
Toc

Table of Contents (9) Chapters Close

Preface 1. Revisiting Arrays FREE CHAPTER 2. Alternative Linked Lists 3. Walking Down Forests of Data 4. Making Decisions with the Help of Science 5. Programming with Logic 6. Sharing by Communicating 7. Transformations as First-class Citizens Index

What this book covers

Chapter 1, Revisiting Arrays, explores some interesting alternative uses for the array data structure. You'll learn in this recipe how to implement data compression using the LZ77 algorithm. Then, we'll see how you can use Pascal's triangle in order to draw some fractals. Next, we'll design a little multithreaded program execution simulator. We will end this chapter by studying an algorithm used to handle a call stack frames operation during a program execution.

Chapter 2, Alternative Linked Lists, delves into the advanced matters related to linked lists. We will cover a method using XOR addressing in order to get doubly linked lists. We'll then cover how to speed up a linked list's element retrieval, thanks to caching. We'll also use this data structure to build a shift-reduce parser. At the end, we'll explore an immutable functional data representation of linked lists by using the skew binary numbers representation.

Chapter 3, Walking Down Forests of Data, focuses on recipes related to tree data structure. First, we'll cover the self-balancing, search-optimized splay tree. Then, we'll elaborate on B-trees and show you how we can use a B-tree in order to build a key-value data store. Next, we'll show you how ropes can be used in order to create an undo-capable text editor. The last recipe of this chapter will be about tries and how they allow you to create efficient autocomplete engines.

Chapter 4, Making Decisions with the Help of Science, gives you an overview of a few machine learning and optimization algorithms. We'll first show you an approach that is used to build live recommendation engines. Then, we'll use the branch and bound algorithm to solve a cost/profit optimization problem, which can only accept a natural numbers solution. Next, we'll use the Dijkstra algorithm in order to find the optimal paths in graphs. The final recipe in this chapter is about using the LexRank algorithm in order to summarize text documents.

Chapter 5, Programming with Logic, focuses on logic programming. We'll first use this highly declarative approach in order to draw interesting facts out of a social networking website's traffic data. Then, we'll show you how a simple type inferencer can be built using logic programming. At the end, we'll design a simple IA module capable of playing one round of checkers.

Chapter 6, Sharing by Communicating, gives particular attention to asynchronous programming. We'll begin by using this concurrency paradigm in order to build a tiny web scraper. Then, we'll go through the process of creating an interactive HTML5 game. Finally, we'll design an online taxi-booking platform as a complex system that could benefit from asynchronous programming.

Chapter 7, Transformations as First-class Citizens, dives into a few particular algorithmic cases inherent to the functional nature of Clojure. We'll start by designing a simple recursive descent parser, making use of the efficient mutual recursion offered by the Trampoline construct. Then, we'll see the new Clojure 1.7 feature—the transducers—in action while developing a mini firewall simulator. Finally, we'll introduce you to the continuation-passing style while designing a little symbolic expression unification engine.

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image