clojurescript

clown -- A Clojure/Script Outliner with Notes

Questions about note-taking are very popular on Hacker News. I am always interested in the responses. It seems like developers are always interested in the best tools and methodologies. Me too. I’ve been researching and using different approaches for decades. Over all that time, I’ve written thousands of notes, both short and long. Most notes become uninteresting after awhile and are just erased. But thousands have persisted for many years because I still refer to them.

Letting the User Change the Sidebar Width in CWiki

Recently, I’ve been working on what I thought was a simple feature – changing the width of the sidebar in the CWiki wiki program. There were two ways the user could do it. First, they could set it manually in the “Preferences” page. Second, and more naturally in my opinion, they could use the mouse to drag the separator between the sidebar and the main article area to the location they wanted it.

Displaying Video from a Webcam using Clojurescript and Reagent

As part of a book cataloging project, I want to be able to use a webcam on a desktop or laptop to scan ISBN (International Standard Book Number) numbers from the jackets of physical books. This isn’t quite as easy as scanning barcodes with a phone or tablet because of focus, magnification, and depth of field characteristics of desktop and laptop cameras. (Or so I’m told. I really don’t know much about it yet.

Autosave Functionality in ClojureScript

Most programs provide an “Autosave” feature these days. The feature gives the user a chance to minimize the amount of work lost due to some unforeseen mishap, like a sudden power outage. When I write a program in Clojure that requires such a feature, I have the entire Java library at my disposal. I usually create something based on a ScheduledExecutorService – something that watches for a change in the document then allows a certain amount of user inactivity to pass before automatically saving the document.

CWiki-Next

For the past few months, I’ve been beating my head against a brick wall. The problem was that I was trying to get an all-server-side wiki built using Clojure. It actually works pretty well. I’ve been using it for personal information for months now. It works well except for one aspect, arguably the most important – editing new or existing content is not that pleasant. It’s all a variation of Markdown, which is nice.

Using Anonymous Functions in the Clojure/Script Thrush Macro

The other day, I was putting together a sequence of operations to transform one piece of text into another form of that same text. The functions took a text argument, and the result was a slightly tweaked version. Put all those functions together to get the fully transformed result. What could be more natural than to string those pieces of code together with one of Clojure’s threading macros: ‘->’ or ‘-».

Clojure/Script has Ruined Me for Other Languages

The Elm language is often cited as an up-and-comer for web front end development. I was attracted to it largely because of the compiler’s friendly and extremely helpful error messages. It’s really attractive in many ways. But when I started looking at examples, I often found myself thinking things like “Why is this so inconsistent?” or “Why is this syntax so complicated?”. And it finally occurred to me that I’ve been ruined by the way Clojure/ClojureScript/Lisp/Scheme do things.

Speech Synthesis in ClojureScript

Just like everyone else, it seems, I’ve been following all of the news about voice-activated personal assistants. There are all the commercial offerings like Siri, Alexa, Cortana, and so on, as well as some DIY projects on the web, like this one and this one and this one.

These types of projects typically involve a front end that converts voice to text, some middle piece that interprets the text and obtains some answer or creates an action, ending up with a voice response by the system back to the user. I have some (out-of-date) experience with speech to text, but not the other end of the process: text to speech. So here’s a little investigation into how to do it with ClojureScript. Turns out that it is almost trivial these days.

ClojureScript with Reagent and figwheel

I have a bit of a love/hate relationship with ClojureScript. On the one hand, it is a Lisp, with all the power it entails. On the other, the development toolchain can be byzantine. With the advent of WebAssembly and ECMAScript6, I have hopes of seeing tail call optimization (allowing true recursion) handled in ClojureScript, if not Clojure itself. And Reagent and figwheel can make web development (not my strong suite) much easier.