Hello all, Clojure n00b here. As a means of learning Clojure, I wrote a little Mustache templating code. (I do realize Clojure libraries for this exist already.)
The last time I wrote any Lisp was a decade ago, so any general advice would be appreciated. Here's the gist: https://gist.github.com/3054620 Example usage is at the bottom. In addition to a general "am I doing this right?", some style/community preference questions came up: - What's a good way to signal errors (e.g. parse errors)? I found the slingshot library, which seemed to provide nice exceptions, but I'm a little leery of pulling in a non-stdlib library just for this. Is there a more standard way to signal exceptional circumstances? - Once a template is compiled, rather than relying on structs or hashes to provide data, I used dynamic bindings. So you can provide a function that fills in the data. Is this a good idea or a bad one? (See example 1.) - A lot of the iteration code seemed to naturally take the form: (defn whatever [args] (let [new-args (some complicated stuff)] (recur new-args))) So all the complicated code is indented 9 spaces from the function declaration right off the bat. Is there a better way to structure things so that I get a little more breathing room? - I'm happy developing from the repl, but debugging was often painful. I would get a one-line error message about e.g. an arity mismatch, with no stacktrace and no way to tell where the error occurred. I see references to third-party tracing libraries. Is this what people use? Is there really no stacktrace available when you an error happens? Thanks for any advice! -- William -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en