Programming clojure reading notes

Written by Keith McDonnell. Last updated on Monday, August 08, 2011.

= Questions

What are multi mehtods & why are they useful?
What chapters can you omit?
What are the data types?
How is functional programming truly side effect free?
What is lazy evaluation?
How do agents compare to erlang actors?
What is a sequence?
Are there any build tools like rake?
How do you unit test?
Why is the current directory not in the java class path (for requiring files)?
How do you handle regular expressions?
What can I leave out (macros, multimethods?)
How do I connect to a web api?
What is the best order to read the book?

Why exactly do I need to use clojure?

= Action points

Download intraday data from google/yahoo and store it in mysql (useful for

#’ function was stored in a Clojure var
user is the function namespace

*1, *2, *3 store the last 3 varialbe assignments

*e holds the last exception

#{} is a Set

A def can define functions or data.

References must be updated in a transaction to handle concurrency:
(dosync & exprs)

Use the @ symbol to inspect a reference, eg @foo

(require ’clojure.contrib.str-utils)
maps to clojure/contrib/str-utils.clj

When you require a function, you must refer to the full name space, eg
(require ’examples.introduction)
(take 10 examples.introduction/fibs)

You can refer to the function at the top level (without using the namespace
prefix) using refer:
(refer ’examples.introduction)
(take 10 fibs)

Reload libs:
(use :reload-all ’examples.introduction)

Use find-doc with a string or regex to search the documentation

use show to enumerate all the Java members (fields and methods) of any Java object:

Division may not execute as expected: could convert to a ration instead:

String & Charachter are delegated to Java

= Review (blog post)

If you'd like to discuss this article, you can send me an email and/or publish an article online and link back to this page.