Sessionless Cookies in Compojure
This demonstrates the use of session-less cookies in Compojure, with working examples.
John McCarthy, innovator and creator of Lisp passed away today at 84.
Although his unique technology is still in use 50 years after it's creation, he will be sorely missed.
I was just working on making a few small changes to LispNYC's website. Did you know the full source to our site, in Clojure, is available on github? Anyhow, while I was working with it, I decided to streamline stuff by moving to the relatively recent lein-ring plugin.
The plugin is simply great. By abstracting away common web development requirements, it allowed me to remove explicit servlet declarations, the 'main' function, dependencies on 2 ring libraries that really should have been development dependencies in the first place, and the need for a separate plugin to generate war files. If you're doing web development in Clojure, I highly suggest you check it out. James Reeves (the author of lein-ring and many other clojure web-development technologies) has a great and simple instructions for getting started. If you're using compojure (like we are!) realize that defroutes generates a ring handler, so you can just use that as the symbol you hand off to the plugin (though for more recent versions of compojure you probably want to use the result of compojure.handler/site).
So today is the day we finalize our application for Google Summer of Code. Fingers crossed, next week I'll be able to blog about how after a two year absence, LispNYC will have been accepted into the program. I really hope we are, because the projects that are shaping up look great and could go a long way in both helping the Lisp community and burnishing its reputation. As a sometimes-computer-musician, I'm particularly excited by the involvement of Project Overtone. It looks like David Liebke of Incanter is getting involved as well.
We're also happy to announce additional support from our friends at Brandorr Group. To show their commitment to open-source, Brandorr has agreed to offer a free Business Class Virtual Machine on Amazon Web Services to any LispNYC students for use on their Summer of Code project.
Before I really get started on posting blog entries for this, it was imperative I figure out a way to blog from Emacs. Cause really, what self-respecting Lisper blogs from a tiny text field in a web browser? Madness.
So, if you also want or have a blog on this site and want to do it in emacs:
- go get weblogger.el I just used ELPA, but there's a later version available.
- Once you've got that loaded, do
M-x weblogger-setup-weblog. When it asks you for the Server Endpoint, enter
http://www.lispnyc.org/blog/xmlrpc. The other parameters (username, password, blog name) should be self explanatory.
There are some issues. Authentication is plaintext, I have to manually type the entries in HTML. But it's still better than a web form!
A good friend, Boyko Bantchev, has compiled a collection of personal web pages of computer scientists and mathematicians; among them are Abelson, Baker, Gabriel, Graham, Greenspun, McCarthy, Norvig, Pitman, and Stallman (to mention just those who are directly related to the topic of this site; there are many others equally or more prominent).
In this blog post I will explain how to use the REPL and play around with it.
I've always liked the Proggy font, the bold punctuation really makes things stand out especially, especially if you program in Lisp where parens aren't just syntactic sugar, they represent functions and power.
So after getting my mits on the Inconsolata font, I did some modifications to create a version with bold punctuation. It's especially helpful in environments that don't offer syntax coloration.
CS Books with LISP, LISP Observations, Self Experiments on LISP
Humpty-Dumpty to Lisp was in thrall,
Humpty-Dumpty played with
All the King's conses on the royal PDP-10
Couldn't intern Humpty-Dumpty again.
By the way, did you know that there is a Humpty-Dumpty reference in the LISP 1.5 Programmer's Manual?
Okay, I want to start off this blog with my personal must-read list for young hackers. Because, you know, you can tell everything about a person when you see his/her bookshelf, right?
Happy New Year!
Even if you have seen this before, I hope you will admire the quality of a good numeric implementation:
> (/ (log -1) (sqrt -1)) 3.1415927 > (typep * 'real) T
Well, I always explain it like this: Acheron is like the Google Web Toolkit (GWT), but instead of Java with Common Lisp (kind of).
If you don't know what GWT does, this doesn't help you much. So let me explain what GWT does in its essence.
While some people like to program in Java, some prefer Lisp over Java. This spawned the idea to create something like GWT for the Lisp world. Acheron is similar to GWT. It allows you to write an application in (a subset of) Common Lisp and compiles
I will explain in this Blog some basics of Acheron (the documentation is currently non-existing, unless you speak German). The next Blog entry will be about how to start the Acheron REPL to get started with Acheron Lisp. In the meantime you can download the compiler and play around with it if you want. The compiler
is open-source and you can get it from Sourceforge:
Network analysis of Clojure projects
I am working on an automatically-generated, browseable directory of Clojure libraries. If I am viewing a library in such a directory, the directory should be able to give me a list of other libraries that I should consider instead, as well as a list of libraries that work well with this one. The directory application could infer such information automatically based on how often various libraries are used together on Github.
While I originally generated the map above as an intermediate step towards that goal, I also found the map itself interesting. There were a lot of projects that I hadn't heard about, and those that I did know about tended to be close to eachother. Did I actually have a position on this map, so that I would only hear about nearby projects? With that in mind, here is a quick tour of Clojure's landscape. Clojure's community is growing fast, and it can be hard to keep up with all the projects. Hopefully I can introduce you to some interesting projects that you haven't heard of before.
1 ) The capital city: Clojure and Clojure-contrib
This is where Rich Hickey and other Clojure/core members are hard at work on Clojure 1.3, including performance improvements such as primitive function arguments, primitive return values, and pods. Clojure/core also provides support, mentorship, training, and consulting services for companies that are adopting Clojure. You can learn more in Rich Hickey's recent InfoQ interview. I just sent in my contributor's agreement and am eager to join the effort.
2 ) Building Clojure projects: Leiningen
Leiningen is an easy-to-use alternative to Java's Ant and Maven. It provides built-in commands for common tasks like downloading dependencies, compiling the project, creating a JAR file, and launching a REPL. Leiningen's creator, Phil Hagelberg, has been remarkably effective at soliciting contributions, and a wide variety of community plugins provide additional Leiningen commands.
3 ) Dev Ops: Pallet and JClouds
Pallet is an alternative to shell scripts and manual server administration. It communicates with cloud providers tostart up new instances, configure those instances based on predefined recipes, and perform day-to-day tasks like deploying new versions of an application.
Behind the scenes, JClouds allows the same commands to work for a variety of cloud providers.
4 ) Cake: a Leiningen rival
Cake competes with Leiningen as a Clojure build tool. It is compatible with most Leiningen project.clj files, and comes with extra features such as fast start-up, a dependency based task model that allows you to extend existing tasks, and an enhanced REPL with paren matching and tab completion.
5 ) Web development: Ring, Compojure, Enlive, Hiccup, and Sandbar
So far, Clojure's web development options are based on small, easily-composable libraries. In other words, more like Sinatra than Rails. Ring provides an abstraction over web servers, as well as support for defining middleware. Compojure takes care of routing. You can generate HTML with Enlive if you prefer pure HTML templates, or with Hiccup if you prefer to write views directly in Clojure. Sandbar takes care of some of the remaining issues, like authentication/authorization and form validation.
Conjure is another option, which is closer to the Rails style.
6 ) Beginner's projects: TryClojure, Clojure 101, Clojure Koans, and LabREPLEach of these projects helps new Clojure programmers to learn the language. Try Clojure allows you to try out Clojure in your web browser, no download required, and even includes a small tutorial. Clojure 101 and these notes are training materials for an online course offered by RubyLearning. Clojure Koans is a test-driven approach to learning, in which you fix small code examples to make tests pass (based on a similar project for Ruby). LabREPL is part of the training materials for Clojure/core's Clojure training program.
7 ) Testing: Midje and Lazytest
Both Midje and Lazytest are alternatives to the clojure.test framework that is built in to Clojure. Midje encourages a separation between the actual tests and "checkers" that determine whether a test passed. Lazytest can be set up to watch your project's files, and rerun the tests automatically whenever your source code changes.
8 ) Musical Clojure: Overtone
I was surprised and delighted to discover Clojure's musical island, at the bottom of the map. Jeff Rose created Overtone as a replacement for a Serge Modular synthesizer that he enjoyed playing with, but that didn't have a save button or other nice abstractions. He presented Overtone at a Rails conference (video).
9 ) Further into the frontier
Brian Carper's Cow-Blog is so far out on the frontier that it doesn't even show up on my map. This blog engine seems to be rather rough around the edges, but I'm considering migrating my own blog from Wordpress to Cow-Blog. I like the idea of taking a peek under the hood and tinkering with the Clojure code. Plus, it looks like it comes with support for syntax highlighting of code examples.
I created the map above by tying projects together that share at least two contributors. Naturally, any single-contributor projects wouldn't show up on such a map, and projects with only a few contributors also have low odds of showing up. Several startups have used Clojure for distributed computing, but projects like Cascalog(video), swarmiji, and clojure-hadoop aren't on the map.
What other projects should be included in a tour of Clojure? Share your ideas by commenting below or on Hacker News.