Lisp for web apps? Tell me more.. (seriously) - blats
======
vikram
I'd use a continuation based framework to get started. Seaside for smalltalk,
plt-scheme or UCW in lisp. I've been using UCW to develop my project. It makes
it really easy to think about the problem. You serve a page, the page has
actions (method calls) which take parameters. The parameters are fields on the
page. It's really easy to think about an application. It lets you prototype in
code.

For our stuff, I started with rails, just found it too hard to get started. I
had to decide what the tables looked like, how I was going to divide the data,
write a model for every table then connect it to a page.

With UCW, I write code which connects to a function call. Simple.

------
erdos2
Here's a detailed link on setting up a scheme server (perhaps more detailed
than many system admins would need). I'd err towards mod_lisp under Apache
rather than run SISC Scheme under Tomcat, but this is a pleasant read:
<http://www.lisperati.com/quick.html>

~~~
gibsonf1
Why did you decide to go with Scheme as opposed to Lisp? (I'm very curious
about the pros and cons)

~~~
ido
Scheme is a dialect of Lisp.

~~~
gibsonf1
I know - what benefits do you get from Scheme over CL?

~~~
ido
I can't speak for the GP, but since it has been 11 hours and he haven't
answered yet I'll give you my answer: it's mostly a matter of taste, or
sometimes if there is a particular library/app/framework for one which you'd
like to use.

~~~
ido
I would also add that at least in my experience the Scheme community was much
friendlier the the Common Lisp one. They don't particularly like novices over
there and it is quite easy to get flamed if you're not careful enough...

~~~
ecuzzillo
There are multiple CL communities. comp.lang.lisp famously sucks, but (for
instance) #lisp isn't so bad.

------
dpapathanasiou
Here's an overview of different approaches:
<http://bc.tech.coop/blog/041017.html>

And here's a list of different web server resources: <http://www.cl-
user.net/asp/tags/web-servers>

~~~
gibsonf1
The libraries we're currently using:

Portable AllegroServe: Lisp Webserver (with Webactions Session control)
<http://sourceforge.net/projects/portableaserve/>

ASDF: Another System Definition Facility <http://www.cliki.net/asdf>

CLSQL: Database interface Library <http://www.cliki.net/CLSQL>

UFFI: Universal Foreign Function Interface <http://www.cliki.net/UFFI>

------
jkush
There's also this resource which is very much for beginners but if you're just
starting to find out all about using Lisp to do web development this might be
a good read:

<http://www.gigamonkeys.com/book/practical-web-programming-with-
allegroserve.html>

~~~
Tichy
Thank you for the link. I used to code in Scheme and enjoyed it very much, it
would be great to get back into LISP one of these days. However, whenever I
see HTML generated from within the code, as it is in that tutorial, it just
feels like it is 10 years behind the state of the art. I think it is much
better to use some kind of HTML templates (but maybe I am wrong?).

Another thing I was looking for when I last evaluated LISP was an OR-mapping
library. I can't go back to executing SQL statements from within my code -
that is also so 90ies. I think there is one project underway to provide OR-
mapping for LISP, but I am not sure if it was ready for prime time yet.

~~~
Zak
It's possible, and reasonably common to use templates with Lisp web apps.
HTML-TEMPLATE and Tal (from Zope) are widely used.

HTML-TEMPLATE: <http://weitz.de/html-template/>

Tal support in yaclml, part of Uncommonweb: <http://common-
lisp.net/project/bese/yaclml.html>

CLSQL provides object/relational mapping; it's quite good:
<http://clsql.b9.com/>

------
blats
Wow, what a response. I am excited by the prospect that at some point in the
near future I can dive into lisp with a clear goal in mind and the resources
to make it happen. I have been hearing for years about how lisp is really the
ultimate programmers language. I respect this lisp-lover's oppinion and
experience ultimately, and put him right in the list with Paul and Carl. So, 3
elite programmers who sing the graces of lisp. One was enough for me to want
to learn to think in lisp. 3 in support should be a point to ponder.

The problem I have always encountered with trying to build a solution in lisp
is the lack of resources. It sounds like lisp is inching closer and closer to
the critical mass where tools and libraries will finally be available for more
then a few uses.

This lisper I know said "Don't hold your breath." when I suggested that lisp
may be coming close to getting its due. I know that there are alot of people
out there like me. We will start using lisp when the great advantages of the
language finally outweigh the disadvantages of implementation. I think its
just a matter of time until lisp is a clear win, as long as the tools come.

I've never written a line of lisp. I want to save my lisp cherry for a time
when I can have more "Yay" then "Doh" while I learn and use it. I think it
will be worth the wait.

------
mattjaynes
From my limited perspective, it looks like one of the major drawbacks
(evidenced in this discussion) is the lack of critical mass for one specific
Lisp stack. Having so many competing setups makes for:

-little documentation

-little support

-limited libraries

-super tiny communities

Compare that to LAMP(P = PHP, Perl, or Python) and Rails. Their communities,
docs, support, libs, etc are HUGE compared to the tiny fractured Lisp
ecosystem.

Do LAMP and Rails have their own problems? Of course. But the point is that
they have been proven over and over and over. Lisp is certainly sexy and will
give you that toned body and hairy chest you always wanted, but beyond Viaweb
and Reddit (cough, cough) can you readily (and without searching) think of
other top sites that have delivered a major hit with it? Second, can you think
of any hit Lisp sites that didn't involve Paul Graham? I rest my case.

I'd love to see this change, but unfortunately that's the current reality.

\------

Update: After doing some searching, I also found ITA's backend Orbitz software
written in Lisp. That certainly was a hit and is also used by many other
systems. The author is Carl de Marcken and this hit is also mentioned in pg's
"Great Hackers" essay.

So, Two Lisp Hit-makers:

Paul Graham, Phd in CS from Harvard

Carl de Marcken, Phd in CS from MIT

So, if you're a Phd in CS from one of the top programs in the _world_ \- I'd
say Go For It! ;)

~~~
asbjxrn
<http://www.lispworks.com/success-stories/netfonds-primetrader.html>

------
brlewis
Sorry, I spent years demonstrating to people how Lisp is better for everybody
doing web development, not just elite programmers. I'm done. My new philosophy
is, if you can't get them to join you, beat them.

Now I'm at a point where my venture absolutely must succeed. I'll take every
advantage I can get.

------
fahree
It's scheme, not CL, but don't forget HOP <http://hop.inria.fr/> and whatever
the PLT people have in store <http://www.plt-scheme.org/>

~~~
jwecker
btw, HOP uses the Bigaloo web server and so isn't quite adequate apparently
for a high traffic site (like I assume most here will have). here's an email
exchange I had with the author the other day- sorry if the comment's a bit
big:

I apologize for such a late answer. I'm always fighting with email. I'm
definitively not good at it because I'm not able to answer at a decent pace.

Hi Manuel. I've just been playing with Hop. Well done. It's just beautiful. A
couple of questions about it: first, the bigloo web server- is this completely
necessary? I guess one of 4 things would need to happen for hop to be totally
ideal: _Bigloo implements light-weight threads Gambit-scheme style so that it
can have erlang-like load capacity
(<http://www.sics.se/~joe/apachevsyaws.html> ) (most preferable option, IMO,
though I have no idea what your feelings are here. To me this would make
bigloo light-years ahead of all other scheme imps.) I have tried several
things concerning the multi-threading. You can read our FairThreads proposal
(<http://www.inria.fr/mimosa/Manuel.Serrano).> When I did this study I though
that FairThreads was a decent solution. Now that's no longer clear to me. Hop
does not use Fair threads but Posix like threads. I'm quite aware of all the
troubles that come with this kind of threads. I have not considered an Erlang-
like solution yet but that's something I could envision.

_ Get hop to work with a gambit-scheme server instead of bigloo (where would i
start with this? can you point me to relevant points in the code?) No, I think
that you cannot. Hop is really not a portable Scheme program. It extensively
relies on Bigloo features. I'm afraid that you will have to rewrite entirely.
It's not a huge program but it is not that small either. The problem is that
it uses a lot of libraries that you would have to re-implement too. All in all
it's about 40.000 lines of Scheme code. I don't really recommend to try to re-
implement that (except if you are very brave ;-)

_Get hop to work with mod_lisp (less preferable, IMO) No. I don't think that a
solution too. Hop needs to be running permanently. That is two successive
requests must be handled in the same execution environment (i.e., the first
request may set a global variable that is read by the second request). Hence,
even if you want to use Apache you will be forced to have a server running
somewhere and you will have to establish a communication between Apache and
that server. Why not directly using Hop as a server?

Second item is the overall latency and possible redundancy... actually, I
don't know how to phrase the problem- but it boils down to this, I counted
over 27 distinct "connecting to server" cycles when you click on the "weblets"
tab of the Hop Home page. It took quite a while re-establishing the connection
to the server 27 times. Are there thoughts on overcoming this? Not really
but... First, the Hop server supports keep-alive connections. This should
help. Then, honestly, I have hoped to find time to optimize the server for
months. I have not found that time yet but I think that I will have it around
the end of Spring. At that moment, I will study the problem you are
mentioning.

However, I'm using Hop on a daily basis. Even more, in order to push it to its
limits, I'm using it as my regular proxy. That is all my HTTP connections, on
all my machines, go through a Hop proxy/server. The performance are
acceptable. That is, I'm not annoyed by an important slow down due to Hop.

Thanks again!! You are welcome. Thanks for the encouragements.

\-- Manuel

------
dhouston
if you're thinking of developing a web app in lisp but haven't looked at
python or ruby, you might consider them -- remember, it's not just the raw
language but also the surrounding infrastructure, and python (django,
turbogears) and ruby (rails) have arguably much more developed frameworks, and
also arguably have most of the interesting language features that would draw
you to lisp in the first place.

the point is the language is only one piece of the equation -- you want to be
spending your time developing your app, not rolling your own supporting
elements (templating systems, init scripts, form validators, sql
bindings/mappers, etc.) and of course i'm sure others will point out reddit's
switch from lisp to python.

~~~
vikram
Most people say that you shouldn't use lisp because it doesn't have libraries.
Well they are only half right. You shouldn't use lisp, because most lisp
libraries have very little documentation. Lisp has a lot of libraries. You
have to be willing to read code (i.e. examples/tests) to figure out how to use
them.

<http://www.cliki.net/Library>

Assuming that the most precious commodity is development time. I'd say
rails/django don't even come close to UCW in getting stuff done.

~~~
rms
Why is lisp so sparsely documented?

~~~
vikram
For me saying what a function does isn't good enough, when one is documenting
an api. Examples are a must. The other problem is that the lisp packaging
system is a bit weird. If a library doesn't have an ASDF definition its almost
non-existent for me.

