Arithmetic with Instaparse

Last week I started playing around with the [Instaparse][instaparse] library, which makes writing parsers really easy in Clojure. What Instaparse does is take the formal definition of a language and give you a parser for that language. You can then use that parser on a string, possibly containing something…

Parts-of-speech tagging with Clojure

One of the classical problems in Natural Language Processing is parts-of-speech tagging i.e. given a sentence of length n, find the sequence of part-of-speech tags for each word in the sentence. For example, $$\text{POS(“the”,”man”,”walks”) = (“article”,”noun”,”verb”)}$$ There are several approaches to parts-of-speech tagging, and…

Making a streaming API from scraped data using Clojure

I recently found myself having to play around with some stock exchange data. The stock exchange in Nepal, unsurprisingly, doesn't provide a data API so I had to scrape their website. The non-realtime data isn't very interesting, just regular old scraping made a little more tedious…

Websockets with Clojure and http-kit

Table of Contents * 1. A (fake) realtime happiness gauge * 2. Project setup * 3. Websocket server * 4. Front end Websocket is a relatively new network protocol that enables a connection between client and server to have long-living connections. What this means is that servers can push things to clients and vice-versa…

Building a database-backed Clojurescript app

In my previous post, I gave a pretty quick introduction to Clojurescript. If you haven’t already, I recommend you read through that post. This post assumes that you have some Clojure knowledge and already have Leiningen running. In this post, I’ll show how to create a SQL database-backed…

Getting started with Clojurescript

There doesn’t seem to be much written about running Clojurescript, especially considering how great a tool it really is. I know there is a book that’s coming out soon, but I had some trouble getting started with Clojurescript so I decided to put together this post, that hopefully…

Fighting an N-headed monster with recursion

A while back, I came upon this problem: “You need to kill an N-headed monster. To do that, you have two swords. The first sword(A) cuts cutA heads, however, in case the monster doesn’t die(ie no. of heads > 0), it will grow growA heads. The second…

A first look at provisioning with Puppet(on a Vagrant box)

In my previous post, I talked about deploying a Flask app on a Vagrant box using Gunicorn and Nginx. The response I got was mind-blowing, so I’ve decided to write about another neat tool that’s awesome for deploying web apps- Puppet. Vagrant actually encourages its users to use…