brool

brool \brool\ (n.) : a low roar; a deep murmur or humming

Archive for the 'clojure' Category

Hadoop Shim To Clojure

Monday, November 8th, 2010
I’ve been working with Hadoop a lot lately in order to do some exploratory data analysis on traffic logs. Hadoop is great; it makes things that were taking 30 minutes run 10x faster, which means that I can iterate a lot faster and experiment with more ways to slice the data. I wanted an easy [...]

Beaujiful Soup

Wednesday, October 27th, 2010
Horrible name, isn’t it? Beautiful Soup is a really nice Python library for extracting content from possibly-sloppy HTML, and I wanted some reasonably close Clojure equivalent. Unfortunately, the standard classes don’t work well with malformed HTML; as an example: [code lang='clojure'] => (require '(clojure [xml :as xml])) => (xml/parse "http://www.google.com") org.xml.sax.SAXParseException: The markup in the [...]

Setting Up Incanter and MySQL

Thursday, January 21st, 2010
Okay, Lein really does make stuff pretty easy. Rather than wrestling with eleventybillion classpaths, just install Lein. Create a new project directory with lein new mydirectory Change the project.clj file that is autogenerated with: [code lang='clojure'] (defproject mydirectory "1.0.0-SNAPSHOT" :description "FIXME: write" :dependencies [[org.clojure/clojure "1.1.0-alpha-SNAPSHOT"] [org.clojure/clojure-contrib "1.0-SNAPSHOT"] [mysql/mysql-connector-java "5.1.6"] [incanter/incanter "1.0-master-SNAPSHOT"]]) [/code] (that is, add [...]

A Modest Proposal

Tuesday, September 1st, 2009
Warning: a very rambling article; less a solid proposal than me just exploring an idea that may lead to a dead end in a week or two after I’ve thought about it. I really enjoy Clojure. Everything seems so well thought out and well designed; in a lot of ways it reminds me of Python, [...]

Snippet: Automatic Proxy Creation in Clojure

Friday, August 21st, 2009
The proxy function makes it easy for Clojure to interface with the Java layer, but I was dealing with an interface (the AIM Java API) that had an punitive number of things that needed to be overridden… [code lang="java"] public void OnIdleStateChange(AccSession arg0, int arg1) { } public void OnInstanceChange(AccSession arg0, AccInstance arg1, AccInstance arg2, [...]

Pattern Matching In Clojure

Wednesday, August 12th, 2009
Updated: Note that this is available as a clojars module. Clojure code density seems to be pretty good. There are a fair number of convenient shortforms in the language; for example, associative datatypes all act as a function — so given a hash map you can reference it with (my-hashmap :key). The base language itself [...]

aset is Faster Than aset-int

Saturday, August 8th, 2009
Clojure isn’t the fastest functional lanuage — that title seems to go to Haskell these days, at least for the stuff that I do — but it nonetheless is usually fast enough. It’s a dynamic language, so is perhaps cursed to be somewhat slower always, but nonetheless for the things that I do, it seems [...]

Tokyo Cabinet API for Clojure

Thursday, August 6th, 2009
I’ve been playing with Tokyo Cabinet and Clojure for a bit, and while I will go on about both of them in another blog post (or not), I have to mention that Clojure is such a well designed language that it’s a pleasure to play with. It has much of the same intrinsic power as [...]