Automatically generate Clojure function proxies for java.lang.Math static methods.
Add this to your project.clj
if you're using Leiningen:
[alandipert/mathemagician "0.0.2"]
Then, in the namespace you want math functions in:
(ns your-ns
(:use [mathemagician :only (abs)]))
(abs -3) ;=> 3
Effort has been made to make the functions that mathemagician
generates fast, but they're still about 5x slower than direct calls to
Math
methods.
If you need better performance, you can substitute your
mathemagician
function calls for Math method calls.
Thanks to Patrick Brown for the idea, Jon Distad for pairing with me on the initial implementation, and to the Durham Clojure Roadshow class for their participation.
Copyright (C) 2012 Alan Dipert
Distributed under the Eclipse Public License, the same as Clojure.