Re: Registering commands in a command language

2014-05-31 Thread Stuart Sierra
You can use the namespace itself as the mapping. For example: (ns app.commands) (defn dothis [ args] ...) (defn dothat [ args] ...) (ns app) (defn execute-command [name args] (let [var (ns-resolve 'app.commands

Re: Registering commands in a command language

2014-05-29 Thread Walter van der Laan
You can do this using multimethods. defmulti and defmethod will allow you to do everything you ask for apart from adding a doc-string to each command. Have a look at: http://clojuredocs.org/clojure_core/clojure.core/defmulti On Thursday, May 29, 2014 3:05:56 AM UTC+2, Will Duquette wrote: If

Re: Registering commands in a command language

2014-05-29 Thread Gregg Reynolds
On Wed, May 28, 2014 at 8:05 PM, Will Duquette w...@wjduquette.com wrote: If there's a better place to ask this kind of question, please point me in the right direction! I'm learning Clojure, and part of the project I'm making is a command language: the user can type commands at the