Category Archives: Clojure API

A Look at cond Function

Here is a look at the “cond” function in Clojure. It’s like “if”, but with more conditions.


You’re welcome.

loop, recur and comp

Here is some code for a few functions that are mentioned in Chapter Five of Clojure For The Brave And True, along with a few modifications/experiments that I did.


You’re welcome.

(not) and its (complement)

Here is a quick look at the Clojure functions (not) and (complement):



You’re welcome.

More Collection Functions

I am going through Clojure For The Brave and True, and I have included some of the functions that I encounter while reading the book.


You’re welcome.

Some Work With Collections

Here are some functions used for working with collections (vectors, maps, sets). I did not include too much with lists, since I think a lot of Clojure people prefer vectors.


You’re welcome.

Some vector functions

Here are a couple of vector functions.

When you use “map” on a vector, you get a list back.

It acts like a list (because for lists “conj” adds at the front; for vectors it adds at the end).

Calling “vector” on it gives you a vector with a list inside it.

So call “vec” on the result to make it a vector.

“vector” can take elements directly.

“vec” must take a collection.

Same with “set”.

You’re welcome.

Some Functions With Maps

Here are some functions with maps.


You’re welcome.

Some Basic Logic In Clojure

Today we will look at some of the basic logic functions in the Clojure API.

There is a library for logic programming called core.logic, which you can look at here. I think that one gets into some hardcore Prolog-like stuff.


You’re welcome.

More Clojure Math Functions

Here are some more Clojure math functions.


You’re welcome.

Clojure rand functions

Here are some examples of Clojure random functions.


You’re welcome.