

Ask HN: Whats the best way to start web development on lisp? - rameshnid

Whats the best way to start web development on lisp?
======
mhd
For Common Lisp, the web server of choice would probably be Hunchentoot[1]. If
you're using it directly, that would be similar to some of the more
lightweight frameworks from other languages (Sinatra, Flask etc.). If you're
looking for a bigger framework, Weblocks[2] could be of interest. Haven't
worked with it myself, though. It does use Parenscript[3], which is a pretty
neat way of writing JavaScript without dropping down to C syntax.

Common Lisp has pretty good support regarding books, libraries and developer
mindshare in the Lisp community (which generally is quite fractured, albeit
not on a Forth level). They can be pretty harsh at times, though.

Personally, I'd recommend going with some simple examples. Getting to grips
with the language, the environment (probably Emacs+Slime) _and_ a somewhat
novel web framework at once can be pretty daunting. So taking baby steps on
the result level, i.e. making stuff that could've been done with CGIs, won't
heap yet another helping of novelties on your plate.

[1]: <http://weitz.de/hunchentoot/>

[2]: <http://common-lisp.net/project/cl-weblocks/>

[3]: <http://common-lisp.net/project/parenscript/>

------
die_sekte
Well, Clojure has Compojure & Ring (like Sinatra & Rack on Ruby). Pretty well
made, but without batteries, and the documentation sucks massively (I've
resorted to reading the source). Also, pretty much everything is still in beta
and APIs change frequently.

For CL, Scheme, Arc, ..., I have no idea.

~~~
brehaut
I recently rebuilt my site[1] in Clojure. Ring at the bottom layer (basically
a given). Beyond that I'm using Moustache[2] for routing, Enlive[3] for
templating and Clutch[3] to talk to CouchDB. I had previously tried with
Compojure and Hiccup.

The hardest parts were learning enlive and moustache. Enlive is incredibly
powerful and very clever, but can be a bit overwhelming for clojure noobs. You
definitely want to check out David Nolen's tutorial[5] for it. Aside from
that, #clojure and the ring google group are full of wisdom.

Deployment wise, I build the site with a basic leiningen[6] uberjar and run it
from an ssh, background it and disown it. yeah, thats terrible, but im lazy
and nobody visits my site anyhow ;) Caveat here: Clojure 1.2 has a small bug
with interned keywords[7] that will knock my site over in a couple of days if
i forget to start it up with the default JVM profile. the -server profile
fixes the trigger issues

Aside from that, I have an nginx gateway server that handles serving my media,
nowww redirection and proxies all dynamic requests through to the jvm. the
site itself hosts a jetty HTTP server via ring to handle all the requests.

The 'hardest' part of getting started with clojure vs say Python+Django or
Ruby+Rails is that there is a lack of 'get you going' magic / tools like
scaffolds or djangos admin. Once you get past that though, it is a very
enjoyable platform inspite of the API changes.

[1]: <http://brehaut.net>

[2]: <http://github.com/cgrand/moustache>

[3]: <http://github.com/cgrand/enlive>

[4]: <http://github.com/ashafa/clutch>

[5]: <http://github.com/swannodette/enlive-tutorial/>

[6]: <http://github.com/technomancy/leiningen>

[7]:
[http://www.assembla.com/spaces/clojure/tickets/444?comment=9...](http://www.assembla.com/spaces/clojure/tickets/444?comment=9542151#comment:9542151)

~~~
ynniv
_run it from an ssh, background it and disown it_

Ack! GNU screen will change your life.

[ <http://www.emacswiki.org/emacs/GnuScreen> ]

~~~
nakkiel
You mean SAVE his life.

------
metamemetics
I visited pg's arcforum today <http://arclanguage.org/item?id=12563> and got
this info by "fallintothis":

 _<http://github.com/nex3/arc/blob/master/help/arc.arc> is from Anarki, a
community-maintained branch of "vanilla" Arc. They wrote such a help function,
but there are also other extensions and differences that are reflected in said
help.

If you're new to Lisp, <http://ycombinator.com/arc/tut.txt> isn't a bad start.
But there are countless Lisp tutorials out there.

As for online documentation: <http://files.arcfn.com/doc/> \+
<http://www.arcfn.com/2009/06/whats-new-in-arc3.html>; see also
<http://arclanguage.org/item?id=12228>, wherein I technically have another
suggestion for learning Arc without the web ;)._

[ Haven't dug in very far yet but Arc tutorial appears to be web development
oriented, and you could look at the HN source code ]

------
enduser
See the Racket docs for getting a simple web app set up: <http://docs.racket-
lang.org/more/>

------
ananthrk
Check out [http://postabon.posterous.com/a-simple-lisp-webapp-for-
begin...](http://postabon.posterous.com/a-simple-lisp-webapp-for-beginners)

------
mcantor
Very interested to see what the experts have to say about this. I gave it a
shot a few weeks ago, but I could barely get to hello world. As a Ruby/Python
programmer, I seem to be spoiled by having _de facto_ interpreters (MRI and
CPython, respectively) with rich standard libraries, all of which are doused
with a great quantity of Google juice.

I was startled to find that "C lisp"--that is, the lisp interpeter written in
C, which you get when doing _sudo aptitude install clisp_ on the latest Ubuntu
distribution--is actually _not_ the "standard" lisp interpreter. I still have
no idea which is, if any.

Still, it seemed like a few of the web frameworks out there should have worked
anyway, so I tried to soldier on for a while. Unfortunately, it was in vain:
my dependency-fu simply wasn't strong enough. I also couldn't find a lisp
equivalent to rack and wsgi, which is something of a non-starter imho.

I'm sure I am making some foolish assumptions, facilitated by the vast chasm
that represents my experience with lisp and its ilk. I also have only managed
to devote a few hours to it so far, so please, no one take this post as gospel
--I'm just sharing what little I have found in case someone else finds it
useful.

~~~
duncan_bayne
I can't help but get the feeling I'm being trolled here, but: the C in CLISP
actually stands for Common, not the C language.

~~~
mcantor
You weren't being trolled; I am simply a moron.

~~~
mahmud
Real morons never admit their mistakes, and are hardly self-critical. I
suspect you're a fake, wannabe-moron: i.e. a closeted intelligent person, with
human decency.

CLISP is not really written in C proper; but files with *.d suffix are C with
heavy pre-processor use that make them look like Pascal. It also uses "var"
keyword to declare new variables, along with shell-style # line comments. It
also uses German for variables and comments. Things have been changing heavily
as of late, and there is more push toward C style and English usage, but here
is what it look(s|ed) like.

[http://clisp.cvs.sourceforge.net/viewvc/clisp/clisp/src/intc...](http://clisp.cvs.sourceforge.net/viewvc/clisp/clisp/src/intcomp.d?revision=1.4&content-
type=text%2Fplain)

The code is beautiful and readable, but very unidiomatic.

~~~
lzw
I see you're a real one.

~~~
mahmud
Calling me a moron, out of the blue, because we disagreed in another,
unrelated thread? Classy.

~~~
lzw
I never used the word moron. It takes a lot of gall to use the insult you used
against someone else and attempt to tar me with it.

Your lack of class is why having a reasonable discussion on this site is
impossible.

------
klutometis
For Scheme, I find that fcgi[1] does the trick: not only is it supported by
Apache, lighttpd, etc., but you get state-preservation between requests; which
is touted, for instance, as one of the benefits of continuation-based
servers[2].

I've shied away from Scheme-based servers[3] hosted behind e.g. forward-
proxies, because it seems to violate Occam's razor; but that's a personal
bias.

[1]: <http://wiki.call-cc.org/eggref/4/fastcgi>

[2]:
[http://en.wikipedia.org/wiki/Continuation#Continuations_in_W...](http://en.wikipedia.org/wiki/Continuation#Continuations_in_Web_development)

[3]: <http://wiki.call-cc.org/eggref/4/spiffy>

------
mark_l_watson
If I am using SBCL, then Hunchentoot. If I am using Franz, then I would use
Portable AllegroServe and WebActions, both of which are installed and ready to
use.

------
mahmud
For Common Lisp, Hunchentoot is pretty sweet.

You can use RESTAS framework <http://restas.lisper.ru/en/>

Example:

<http://restas.lisper.ru/en/tutorial/hello-world.html>

It's extremely well documented too.

~~~
sedachv
RESTAS is actually one of the CL frameworks that I can sort of recommend
because it doesn't try to do too much, and it doesn't have any continuation
brain damage in it.

I don't like web frameworks, here's what I currently recommend:
<http://news.ycombinator.com/item?id=1778708>

The RESTAS documentation just got translated from Russian, I'm actually
supposed to proofread it this weekend.

~~~
mahmud
That's weird, I could have sworn _I_ wrote that ;-)

Concur 100%; hunchentoot + postmodern. No continuation crap there.

------
JoelMcCracken
I think this depends a lot on what you're looking for. I love lisp, but I
wouldn't bet a startup on it. Ruby/Rails is simply too complete to use
something else.

Bliss could come from a combination of the two, however.

~~~
projectileboy
I disagree; Clojure on Google App Engine is a pretty solid platform for web
development,and by now there's a lot of online help to get you started.

But your first sentence says it all - depends on what you're looking for. If
you're outside of the cloud (by choice or necessity) Ruby/Rails,
Python/Django, or even Groovy/Grails are all tough to beat.

~~~
JoelMcCracken
Yeah, its just the whole "there are lots of gems" argument, and ruby is a
pretty nice language anyway.

