Dynamically generating high performance functions in clojure

Posted by mikera on Stack Overflow See other posts from Stack Overflow or by mikera
Published on 2010-05-13T15:53:53Z Indexed on 2010/05/13 16:24 UTC
Read the original article Hit count: 225

I'm trying to use Clojure to dynamically generate functions that can be applied to large volumes of data - i.e. a requirement is that the functions be compiled to bytecode in order to execute fast, but their specification is not known until run time.

e.g. suppose I specify functions with a simple DSL like:

(def my-spec [:add [:multiply 2 :param0] 3])

I would like to create a function compile-spec such that:

(compile-spec my-spec)

Would return a compiled function of one parameter x that returns 2x+3.

What is the best way to do this in Clojure?

© Stack Overflow or respective owner

Related posts about clojure

Related posts about code-generation