Can a clojure application expose an API to clojure plugins?


Some programs expose plugin APIs to python or perl plugins. Can I do the same with clojure?

Update: It seems can potentially do what I want.


You can call into Clojure from any JVM-based language using the built-in API documented here


I was looking for a way to embed a clojure script in a clojure program in the same way you expose certain C API to lua scripts run by embedded lua runtime.


I’m not sure I understand you. Clojure code is “just data” so you can execute Clojure using Clojure. You don’t need an API for that. Could you explain what you are trying to do? Do you just need the eval function perhaps?


chibi scheme can be embedded into C programs. A C program can embed chibi scheme interpreter and inject C functions into it. The interpreter has access only to those injected C functions.

Another example is which contains addons that have access to hexchat plugin API. Those hexchat addons don’t have full access to all C functions and variables.

I want to inject namespaces into interpreted clojure scripts which will not have access to other namespaces.

I know there have been attempts to create clojure sandbox which all ceased to continue years ago.