Clojure Programming/Examples/API Examples

This page gives example usage for Clojure API function calls. For a more general introduction to Clojure by example please see http://en.wikibooks.org/wiki/Clojure_Programming/By_Example

DocumentationEdit

This page provides examples for the following functions.

Data StructuresEdit

NumbersEdit

Computation + - * / inc dec min max rem rationalize
Comparison == < > <= >=
Predicates zero? pos? neg?

StringsEdit

CharactersEdit

Advanced Data StructuresEdit

ListsEdit

VectorsEdit

MapsEdit

Struct MapsEdit

Array MapsEdit

SetsEdit

ZippersEdit

SequencesEdit

Sequence BuildingEdit

Mapping OperatorsEdit

This page provides examples for the following functions.

MacrosEdit

do MacrosEdit

This page provides examples for the following functions.

Variable DefinitionEdit

This page provides examples for the following functions.

MultiMethodEdit

This page defines the following functions

Reference ToolsEdit

This page defines the following functions.

Predicate functionsEdit

This page provides examples for the following functions.

Recursion ToolsEdit

This page defines the following functions.

Function ToolsEdit

This page provides examples for the following functions.

Java InteractionEdit

This page provides examples for the following functions.

NamespacesEdit

nsEdit

(ns test.test 
  (:refer-clojure :exclude [+ -])) 
(defn + 
  [a b] 
  33) 
(+ 1 2) ;= 33 

requireEdit

(require '[clojure.zip :as zip]) 
(require ['clojure.contrib.sql :as 'sql])

Misc.Edit

testEdit

user=> (defn
  #^{:test (fn []
    (assert (= 4 (myadd 2 2))))}
  myadd [a b]
  (+ a b))
#'user/myadd
user=> (test #'myadd)
:ok

Last modified on 5 July 2010, at 16:01