sábado, 28 de enero de 2012

Lisp and the web (probably part 1)

I've tried some lisp frameworks with different intensities and approaches, without settling with anyone of those. Just looking around.

As a first approach, I'm going for the minimalist frameworks. Caveman (on top of Clack), and RESTAS.

My first experience is with caveman, as I want something really simple, and known. Not that I've worked with Sinatra/Rack nor Flask/WSGI, but at least, the architecture is more well known that with other fw like weblocks or RESTAS.

With Toni, we've been hacking a bit our way to do a super simple micro app. And we stumbled upon a few WTFs, or undocumented Caveman spots, or just blockers for us due to our lisp newbieness. Luckily, most of them are solved now :)
  • In GETs, (getf params :id) work, but in post POSTs, the symbols are presented in a different format (getf params :|id|). As davazp pointed, this probably has some problems issues with CL never garbage collecting those interned symbols.
  • clsql:*default-database*. clsql will use *default-database* database handler if you dont's specify any. This makes using clack's middleware for clsql transparent from caveman apps.
  • Getting caveman through quicklisp threw some erros during installation. Installing newer version of sbcl just solved it. (http://comments.gmane.org/gmane.lisp.steel-bank.announce/111)
     * new feature: SB-EXT:VALID-TYPE-SPECIFIER-P returns whether a given type
specifier is valid where "valid" basically means "would be accepted as
second argument of TYPEP".

  • cl-project doesn't create the link in ~/quickload/local-projects on new generated projects . If you create your projects under ~/quickload/local-projects, quicklisp will be able to quickload it, but if you put it somewhere else, you should create a link to your project.

I'm now struggling with form-builder, and widgets (no docs nor examples at all). We'll see how it goes.

before forgetting them

A couple of amazing links for the weekend

miércoles, 25 de enero de 2012

stylish ruby

Here you have a couple of style guides related to ruby, rails, and some tips on functional programming and a few not-so-trivial techniques like currying, TCO, or just using immutable structures.

Apparently, all things explained in all those guides are obvious, or just a matter of taste, but you better read those guides a few times each to make those rules stick in your head, just to be sure :)

First, a guide from bbastov (of emacs prelude fame), that's already in github and forked more than a hundred times, so we could say it's a community ruby style guide.

Second, another bbastov's guide, this time on Rails 3.

And last but not least, slides of a friend of a friend's workshop on Functional Ruby. Really nice, and full of nice tricks that deserve to be read and understood.

That's all for now. Back to hacking

viernes, 20 de enero de 2012


Step by step, I keep getting more and more of what's lisp about.

Not just the syntax (huh?) or the core lib, but idioms, design decisions, and the vision.

One of the mottos of Lisp is the famous 'code is data, and data is code'.
For me, that's not 100% clear yet, but I get more insights every day.

One implication of this is when you look at s-exps and see them as a datastructure, not as code. That's the macro point of view. If you want to know more about macros, I can only recommend you Paul Graham's OnLisp, and Doug Hoyte's Let Over Lambda. I'm now reading through the latter and I find it a perfect companion for OnLisp.

The other direction is 'data is code'. To exemplify this side, here are a couple of links that really get to the point of this (at least one part of the point).