Matt Might’s shell scripts for checking writing style are simple and effective, as is Benjamin Beckwith’s port of them to an Emacs mode. They pick up on some common defects in technical writing, such as use of the passive voice, weasel words and lexical illusions (inadvertent repetition of words.)
As a fun exercise, I decided to port this code to a variety of languages. To start with, I chose ClojureScript. I’d ultimately like to get to the point where I could create a bookmarklet or browser extension for checking my style when writing prose straight into the web browser.
My project’s called Wascal, and it’s the perfect way to eliminate those wascally weasel words, passive voice and duplicate words from your writing. Check out the code here on GitHub.
Here’s a screenshot of the Wascal in action. Below that I’ll present several observations about ClojureScript, discovered while writing the code

A few observations
ClojureScript’s regular expression support is that of JavaScript’s, as opposed to the Java regular expressions used by Clojure. This is fine, but you’ll need to hunt down a decent reference to them on the web—which turns out to be hard. Most material with a high Google ranking omits to mention the use of \1, \2 etc for back-references in matching expressions, and also that, in substitution expressions, $& is the back-reference for the whole matched expression.
ClojureScript’s default library for manipulating the DOM comes from Google Closure. While I love the minification and dependency handling parts of Closure, it does not present a nice interface for manipulating the DOM. Fortunately a variety of alternatives exist, none of which I’ve tried yet. The most promising to me seems to be Chris Granger’s pinot, wonderfully named as a complement to his noir Clojure web framework.
JavaScript interoperability is one of ClojureScript’s incredibly strong points, but will also always be a source of confusion for the beginner. For instance, in order to call the JavaScript e.preventDefault() I had to write (. e (preventDefault)), as opposed to (.preventDefault e). The latter returns the preventDefault method itself, whereas the former invokes it.
-
nervous-noodle likes this
-
eddology posted this
