- ANN tags:
- clojure
- project published: true comments: true
As shake goes public, I received a lot of feedback. The top issue is about using clojure variables in shake macros. Now it has been fixed in 0.2.2. Let me show you the new syntax.
Using vars, local bindings in shake macros:
[cc lang="clojure"]
(require '[shake.core :as sh])
(let [x "/home/nsun"]
(sh/ls -l $x))
[/cc]
So you have to prefix the clojure variable with a dollar sign. This is quite similar to what we did in shell programming.
And more interesting, you can also use a $ prefixed clojure form in shake:
[cc lang="clojure"]
(sh/curl $(format "https://github.com/%s" "sunng87"))
[/cc]
Thanks to Clojure macro system, it has great flexibility to manipulate symbols and code lists, making inventing new syntax much easier than other languages. Shake can be a great example in describing macro system.