background preloader

Clojure

Facebook Twitter

Caffeinated Simpleton » Blog Archive » Fifth: Static Storage and. Clojure setup. So it turns out getting set up to write Clojure code can be a little tricky. There are a lot of disconnected tidbits about how folks have figured out how to configure things, but it can be a bit tricky to tell the difference between, "hey, this is how I finally got it to work" and "this is how you really should be doing it".

I figure I know about as much about using Clojure with Emacs as anybody, so here's a run-through of how I've done my setup. There are a lot of moving parts, but bear with me; most of the installation is automated. Spoiler Alert: Using SLIME with Clojure is now much easier than the instructions detailed below indicate. This page is left up as it provides some background that may be helpful, but if you just want to get going with SLIME, try the Getting Started page on the official wiki. The Pieces The Emacs Lisp Package Archive functions as a centralized store for Emacs libraries and provides automated installation and upgrades. clojure-mode swank-clojure clojure-test-mode.

Leiningen Emacs ELPA slime/swank install problems - Cloj. Leiningen Emacs ELPA slime/swank install problems - Cloj. Caffeinated Simpleton » Blog Archive » Fifth: Static Storage a. Pcollections - Google Code. Brool's tokyo-cabinet at master - GitHub. Clojure rich hickey datatypes. > I'm still trying to get my head around the new features. Seeing more > code examples will definitely help. In the meantime, here is some > stream-of-consciousness thoughts and questions. > > Datatypes: > > I'm a little worried about the strong overlap between reify/proxy, > deftype/defstruct, and defclass/gen-class. I can just imagine the > questions a year from now when people join the Clojure community and > want to understand how they differ.

So I think that eventually, there > needs to be a very clear "story" as to why you'd choose one over the > other. Yes, but there will be a transition period. A big part of the design thinking behind these features went like this: Clojure is built on a set of abstractions, and leverages/requires that the host platform provide some sort of high-performance polymorphism construct in order to make that viable. Reify is Clojure semantics and proxy is Java/host semantics. *** Prefer reify to proxy unless some interop API forces you to use proxy.

Clojars and Leiningen Automate Library and Dependency Management. Clojure performance tips « Occasionally sane. I originally wrote this in a Google Groups thread, but I figured it’s worth repeating here. Somebody posted a Java and Clojure snippet to the Clojure Google group and mentioned that the Java code was vastly faster than the Clojure code and he wondered if Clojure could get within reach of Java’s speed.

In my own clj-starcraft project, I faced — and actually, still face — performance problems vis-à-vis Java. Specifically, at the time of this writing, my Clojure code is roughly 6 times slower than Java (Clojure takes around 70 seconds to parse 1,050 files, Java takes 12.) The 70 seconds figure used to be much worse however. At the beginning of the project, it took over ten minutes to analyze my 1,050 files. Thanks to Java’s nice profilers and the friendly Clojure folks, I was able to improve the performance of my program. (set! Fixing all the instances where *warn-on-reflection* complained improved the performance of clj-starcraft from ten minutes down to about three and half.

Caveat. Datatypes and Protocols - early experience program - Clojure | G. > I'm still trying to get my head around the new features. Seeing more > code examples will definitely help. In the meantime, here is some > stream-of-consciousness thoughts and questions. > > Datatypes: > > I'm a little worried about the strong overlap between reify/proxy, > deftype/defstruct, and defclass/gen-class. I can just imagine the > questions a year from now when people join the Clojure community and > want to understand how they differ.

So I think that eventually, there > needs to be a very clear "story" as to why you'd choose one over the > other. Or better yet, maybe some of the older constructs can be > phased out completely. Yes, but there will be a transition period. A big part of the design thinking behind these features went like this: Clojure is built on a set of abstractions, and leverages/requires that the host platform provide some sort of high-performance polymorphism construct in order to make that viable. *** Prefer deftype to defstruct, unconditionally I don't.

Brool » Tokyo Cabinet API for Clojure. 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 Haskell, but in a fashion that might be more approachable for people coming from Python or Ruby. At any rate, I made a small, thin layer around the Tokyo Cabinet API, and put it on Github. Another thin wrapper can be found at this blog. Copy of the README is below (the ultimate in lazy!). Introduction This is a simple interface to the Tokyo Cabinet libraries. Note that this is appropriate for local storage only — if you’re looking to share a Tokyo Cabinet to multiple computers, you actually want Tokyo Tyrant. Basic Usage The with-cabinet call creates/opens a cabinet and allows the use of the various access routines within the scope of the call.

This creates a Tokyo Cabinet hash table, which allows one value per key. Links. Object Computing, Inc. - Java News Brief - March 2009. By R. Mark Volkmann, Partner Object Computing, Inc. (OCI) last updated on 6/2/13 Contents Introduction The goal of this article is to provide a fairly comprehensive introduction to the Clojure programming language. Please send feedback on errors and ways to improve explanations to mark@ociweb.com, or fork the repository and send a pull-request. You said X, but the correct thing to say is Y. Updates to this article that indicate the "last updated" date and provide a dated list of changes will be provided at Code examples in this article often show the return value of a function call or its output in a line comment (begins with a semicolon) followed by "->" and the result. (+ 1 2) ; showing return value -> 3 (println "Hello") ; return value is nil, showing output -> Hello Functional Programming Functional programming is a style of programming that emphasizes "first-class" functions that are "pure".

In practice, applications need to have some side effects. Online Learning in Clojure ← Structure & Process. Online Learning is a relatively old branch of machine learning that has recently regained favour for two reasons. Firstly, online learning algorithms such as Stochastic Gradient Descent work extremely well on very large data sets which have become increasingly prevalent (and increasingly large!). Secondly, there has been a lot of important theoretical steps made recently in understand the convergence behaviour of these algorithms and their relationship to traditional Empirical Risk Minimisation (ERM) algorithms such as Support Vector Machines (SVMs).

In order to understand these algorithms better, I implemented a recent one (Pegasos, described below) in Clojure. This had the added advantage of seeing how well Clojure’s performance held up when doing some serious number-crunching. Online Learning One very appealing property of online learning algorithms is that they are extremely simple. Models are usually represented as vectors of weights for the features used to represent the examples. Statistical Learning in Clojure Part 1: LDA & QDA Classifier.

This will hopefully be the first of a series of posts based on a book that has substantially influenced me over the last several years, The Elements of Statistical Learning (EoSL) by Hastie, Tibshirani, and Friedman (I went and got a degree in statistics essentially for the purposes of better understanding this book). Best of all, the pdf version of EoSL is now available free of charge at the book’s website, along with data, code, errata, and more. This post will demonstrate the use of Linear Discriminant Analysis and Quadratric Discriminant Analysis for classification, as described in chapter 4, “Linear Methods for Classification”, of EoSL. I will implement the classifiers in Clojure and Incanter, and use the same data set as EoSL to train and test them.

The data has 11 different classes, each representing a vowel sound, and 10 predictors, each representing processed audio information captured from eight male and seven female speakers. Details of the data are available here. (eq 4.7) (a) Chaos Theory vs Clojure « Best In Class – The Blog. Home. Using Clojure as an embedded / hosted scripting language - Cloju.