Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

A library of various small but handy clojure utility functions

README.md

clojure-utils

A library of various small but handy Clojure utility functions

Of particular interest:

  • Clojure.java - Java class of utility functions for calling Clojure from Java
  • arrays.clj - manipulating Java arrays
  • core.clj - handy functions that should have been in clojure.core :-)
  • error.clj - handling errors and exceptions
  • expression.clj - analysing Clojure expressions
  • find.clj - searching for items within different types of collection
  • logic.clj - extra logic functions / macros (e.g. xor, nand)
  • loops.clj - extra looping constructs and macros
  • macros.clj - some handy macros
  • namespace.clj - for merging / managing namespaces
  • test.clj - tools for handling text strings
  • vectors.clj - useful functions for working with Clojure persistent vectors

Clojure calling example

Perhaps the most useful feature in clojure-utils is a set of utility functions designed to allow easy calling of Clojure code from Java. These are contained in the mikera.cljutils.Clojure class. Usage example:

import mikera.cljutils.Clojure;

public class Demo {
    public static void main(String [] args) {
        String s = "(+ 1 2)";
        System.out.println("Evaluating Clojure code: "+s);

        Object result = Clojure.eval(s);
        System.out.println("=> "+ result);
    }
}

License

All the code I have written in clojure-utils is licensed under the LGPL v3.

Exceptions apply to some specific code which has been incorporated from elsewhere under permissive licenses that allow this: see the source files for more information

Something went wrong with that request. Please try again.