Webdevelopment in Common Lisp - lisp

I am somewhat familiar with Scheme. I am reading OnLisp, and would love to do a real world project in it. Most likely web development. I would love to know what kind of setup people use to develop websites in lisp. I have a couple of macs at home and I have figured I would use clozure cl. I am wary of a few things though. I have read on the internets that cl doesn't have reliable threading facility nor good networking. Is this true? What was your experience?
PS:Don't tell me about clojure :). Lisp is a itch I need to scratch.

Currently I'm using Restas a framework based on Hunchentoot and inspired by the route system of Rails. I also use Postmodern to interact with a PostgreSQL database and I generate HTML with cl-markup though I'm thinking about switching to cl-who which looks more customizable.
When I've started I've also considered using Parenscript to generate the JavaScript but now I'm just happy with Mootools and plain JavaScript.
Everything runs on SBCL and is available with Quicklisp.

Not sure why it wouldn't have "good networking"; you can't rely on threads if you want to write a portable Common Lisp application since certain implementations don't support them (AFAIK, just clisp, though you can compile it with experimental thread support). If you plan on picking an implementation and sticking with it, you won't have that problem.
The "standard" CL web stack is Hunchentoot/cl-who/clsql, though you can find tutorials that run on Araneida or Portable AllegroServe.
The setup I use is Debian/SBCL running quicklisp and the above systems along with MySQL (though I'm seriously considering jumping over to Postgres) for the database and nginx to run in front of Hunchentoot serving any static content.

mck- has been maintaining the heroku common lisp webapp.
https://github.com/mck-/heroku-cl-example/tree/

The problem with Common Lisp's "networking" is, we don't have sockets in CL standard, so each implementation has it's own socket API. We have some attempts to give a common interface though, like usocket. You can find a list of networking related packages here.
If you need a web framework, look into Caveman. I haven't used it yet but it looks like the most complete CL web framework I've ever seen.

Related

Comparison of Clojure web frameworks [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
There are a few web frameworks for Clojure
Compojure
Webjure
Conjure
Moustache
and also some libraries for dealing with certain web development subtasks, such as
Enlive for templating
Hiccup for templating
Ring to handle lower level stuff with requests/responses
ClojureQL for persistence (it doesn't seem very active, though)
There are also hundreds of Java libraries to be used. Some aspects were already discussed here and two of them compared a bit.
I wonder how these frameworks/components compare in terms of maturity, scope, ease of development, Django/RoR feeling, etc.
When I first started with web development, it was with Clojure. I had no prior experience with web development at all. I could not, for the life of me, figure Compojure out. I don't know if beginner documentation has been improved since then (it wasn't that long ago) or not, but at the time, I couldn't manage it. A friend pointed me to Moustache and after reading the README, I was able to throw together what is http://try-clojure.org in it's current state. So, as far as ease of use goes, I think Moustache takes the cake for me.
However, if this has existed at the time, I might be singing a different tune.
Conjure looks very cool, though very different from the other frameworks. Given my very limited experience with web development in general, I don't have much say in this matter, but Conjure feels kind of unclojurey to me. It just doesn't feel right. It may just be that I'm not used to the way it does things.
UPDATE: It has been a while since I wrote this. Lots of things have changed. Not many people use Moustache anymore, and it isn't really actively maintained, though it was complete enough (and simple enough) that it probably still works, I'd now recommend going with Compojure or Noir instead. Both of these are currently maintained frameworks and both are excellent at their job.
UPDATE 2: Noir has been deprecated for quite a while and most of its functionality moved to a library designed to be used from compojure/other ring-based web frameworks called lib-noir.
I know this question is a bit dated... but I couldn't help but suggest Noir as a very nice option.
Noir uses a combination of Ring, Compojure, and Hiccup to get the job done. Check it out!
As mentioned in Bjorn Lindqvist's comment above, Noir is dead. Details here.
Instead, consider using Compojure and lib-noir.
Thinking in terms of frameworks is probably a mistake. The better approach is to think in terms of library components which you put together in order to have the 'framework' which best suits your requirements.
I have used a number of frameworks in the past. Most of them do a reasonably good job at getting you up and running with a basic application quite fast. However, without exception, I have found all of them just get frustrating more often than not. Often it is due to too much boilerplate or just having to jump through hoops which are not relevant for the application your developing.
When first coming to Clojure, I started looking for frameworks, but then realised this was the wrong approach. Instead, I found it much better to just start with a basic ring application and then add libraries as I needed them. This can seem like a bigger learning curve to start with, but in fact it turns out to be just as efficient because your not forced to learn a whole heap of framework scaffolding which you often don't need.
However,I have found looking at various frameworks really useful as it gives me ideas of how to best integrate a library and more importantly IMO, how you can best structure your lein project.clj file to best suit the workflow you want.
I've found the following templates really useful. I don't use any of them 'as is', but have adapted/stolen ideas from many of them to develop the frameworks which best suit the app I'm working on
Luminus and Luminus templates provides a very extensive framework. I find them a little 'heavy' for many applications, but there are some great examples of how to integrate various Clojure libraries into your app. The main website also has some useful documentation.
Reagent Project, which includes a reagent template provides a good starting point for an app using Reagent (react.js) ClojureScript support. I've found this to be one of the easiest ClojureScript libraries to create an app with good Javascript integration.
lein-figwheel is a really interesting template using figwheel to provide dynamic loading of clojurescript so that you see your ClojureScript changes in the browser as you modify your code. Many other templates have now added this functionality to their own templates. Originally developed with Om in mind, Luminus and Reagent templates now also integrate Figwheel functionality in their templates. Really shows some of the benefits of Clojure and ClojureScript for interactive development.
Compojure Template is a great starting point. It sets up a very basic compojure based project with all the basic ring and compojure stuff. Great way to start with Clojure web development because it is simple and allows you to focus on the basics before drowning under all the other options.
There are many other templates and frameworks, many of which I've not had time to look at yet. These days, I often start with either compojure template or reagent template and then add additional bits if and when required. I usually also include selmar for templates and use essentially the same configuration Luminus uses.
Perhaps the most important part of getting a good 'framework' for you web development is to experiment and understand how lein works and the lein project.clj file. Having a good project.clj file will determine your workflow. Having the right profiles, ability to start the repl in different ways and load different libraries which allow you to kick off figwheel or a browser repl or generate a jar etc is all about your project.clj file. Get this right and your environment will provide just the workflow you need.
A new player appeared in the scene as a good alternative to implement REST services is liberator. It makes easier to expose your data as resources while automatically complying with all the relevant requirements of the HTTP specification RFC-2616 and plays nicely with http-kit and Compojure.
Pretty happy with http-kit btw, the live code reload feature is handy.
try road framework for fast web dev
https://github.com/zhujinxian/road
(defn render-test [ret tmt]
(-> (resp/response "------render----test------")
(#(resp/content-type %1 "text/plain"))))
(defn foo
"I don't do a whole lot."
[x]
(str "来自源码目录的参数:" x))
(defn handler [^Integer x]
{:$r render-test :text (str "hello world, road goes sucess!" (foo x))})
(defn home [req content ^Integer num]
{:hiccup "home.clj" :content (str "home" content) :num num})
(defroad road (GET "/web-test-0.1.0-SNAPSHOT-standalone/main" handler)
(GET "/web-test-0.1.0-SNAPSHOT-standalone/home/:num{\\d+}" home))
(defn -main [& args]
(log/info "---------log4j test-------")
(jetty/run-jetty road {:port 3000}))

How can I do web programming with Lisp or Scheme?

I usually write web apps in PHP, Ruby or Perl. I am starting the study of Scheme and I want to try some web project with this language. But I can't find what is the best environment for this.
I am looking for the following features:
A simple way of get the request parameters (something like: get-get #key, get-post #key, get-cookie #key).
Mysql access.
HTML Form generators, processing, validators, etc.
Helpers for filter user input data (something like htmlentities, escape variables for put in queries, etc).
FLOSS.
And GNU/Linux friendly.
So, thanks in advance to all replies.
Racket has everything that you need. See the Racket web server tutorial and then the documentation. The web server has been around for a while, and it has a lot of features. Probably the only thing that is not included is a mysql interface, but that exists as a package on PLaneT (Racket package distribution tool).
UPDATE: Racket now comes with DB support, works with several DBs including mysql.
You may want to have a look at Clojure:
Clojure is a dynamic programming language that targets the Java Virtual Machine. [...] Clojure provides easy access to the Java frameworks, with optional type hints and type inference, to ensure that calls to Java can avoid reflection.
Clojure is a dialect of Lisp, and shares with Lisp the code-as-data philosophy and a powerful macro system.
Interop with Java is straightforward in Clojure, so you can re-use any existing Java libraries as you need. I'm sure there are plenty that are useful for web development.
clojure-contrib has an SQL API, and there is ClojureQL as well, which should cover your DB access needs.
There is a web framework for Clojure called Compojure under development. There may be others, too.
Clojure's source is available on github under the EPL. Getting it running on Linux is easy; I just clone the git repos and run ant.
You can do web development with guile scheme. Its standard library includes the (sxml simple) module that is very useful for html generation, manipulation, and parsing. The guile-www library adds support for http, cgi, etc. The guile-dbi library provides access to MySQL and other databases. With these building blocks, you can implement everything from simple cgi scripts to web applications with their own HTTP server.
Try Weblocks, a Common Lisp web framework:
http://weblocks.viridian-project.de/
I've written a pretty extensive tutorial/ebook on the topic: http://lispwebtales.ppenev.com/
Quick summary:
It uses Common Lisp
It uses the Restas framework
It has examples for pretty much most of basic web development, including DB access, authentication, HTML generation and templating.
Since the Restas documentation is pretty much out of date, my tutorial is the closest thing to up to date docs.
Shows a few of the more advanced features, like policies, which allow you to write pluggable interfaces, for instance you can write a data store layer, and write back-ends for different storage mechanisms with relative ease, the module system which allows you to write reusable components, like auth frameworks and things like that.
It covers things like installing lisp, setting up the ASDF build system and the quicklisp package manager etc.
It's free online, and as soon as I finish it it will be free on leanpub as well. The source is on https://github.com/pvlpenev/lispwebtales under a CC license, the source code is MIT. Not all of it is published yet, and I'm in the process of revising.
This may be what you are looking for.
http://www.plt-scheme.org/
http://docs.plt-scheme.org/web-server/index.html
http://common-lisp.net/project/cl-weblocks/
If you are interested in Common Lisp to be exact and do not want to go the weblocks route I would recommend the following setup:
Use SBCL on Linux but with multiple thread support
Use Hunchentoot as a web server which will provide you with all the server processing required including sessions and cookies
Use ClSql to communicate with MySql it has ample documentation and is very stable.
For the HTMl generation you can use Dr Edi Weitz Cl-WHO (very well documented).
Note all the above are under GPL or similar license (one that works more for lisp programs)
Gambit Scheme has its own solution to web apps as well. It uses the Spork framework, based o the Black Hole module system (both by Per Eckerdal).
Andrew Whaley has an initial tutorial on how to get Gambit, Black Hole and Spork running a web app under Apache using mod_proxy. You might want to take a look at that.
On a (possibly) related note, Gambit will also compile your stuff to C and then to an executable, if you feel so inclined.
Paul Graham (and friends) made a lisp dialect specifically for writing basic web applications. It's called Arc, and you can get it at arclanguage.org.
It's probably not suited for really big complex websites and I'm not sure what state it's database support is at but Paul Graham knows how to write web applications in lisp, so Arc will make the HTTP/HTML part easy for you while you spend most of your brain cycles learning the lisp way.
Weblocks is nice tool for building web apps in Common Lisp, but a bit too heavy-weight for me.
We use the following stack:
OpenMCL (open source Lisp, very nice)
Portable Allegroserve (web server, HTML generator)
Our own Rails-like tools for doing Ajaxy stuff (update: this has now been open sourced as WuWei)
A variety of CL libraries like cl-json, cl-smtp, md5
I use my own, customized version of Scheme, derived from MzScheme. It has a new, simple web-application framework, a built-in web-server (not the one that comes with MzScheme) and ODBC libraries. (http://spark-scheme.wikispot.org/Web_applications). The documentation may not be exhaustive, as this is more of a personal tool. But there are lots of sample code in the code repository.
Clojure is a Lisp dialect which may interest you. At this point there's a pretty decent web development stack. I can recommend a few things:
The leiningen dependency manager which makes is really easy to install and manage libraries that you're using. Pretty nice set of plugins for it too. There's even a plugin for Clojurescript, which is a language based on Clojure that compiles to Javascript.
The ring HTTP server abstraction. Its used in most actual web frameworks. Its a pretty good idea to learn that first before jumping into an actual framework.
hiccup is a HTML dsl/templating language written in Clojure. Its very expressive! Reminds me a bit of Jade, in a sense.
composure would have to be the most popular web framework for Clojure. Its essentially a routing library like express.js.
Let's see what can be done with Common Lisp.
The state of the Common Lisp ecosystem (2015) and the Awesome Common Lisp list show us a couple of modern frameworks (Caveman, Lucerne, all built on the new Clack web application server, an interface for Hunchentoot and other servers). Let's discuss with our own findings.
update 2019: there's a new tutorial on the Common Lisp Cookbook: https://lispcookbook.github.io/cl-cookbook/web.html It covers routing, template engines, building self-contained binaries, deployment, etc.
update: a bit later, I found out Snooze, by the creator of Sly or Emacs' Yasnippet, and had a much better impression than say Caveman. Declaring endpoints is just like declaring functions, so some things that were tedious in Caveman are obvious in Snooze, like accessing the url parameters. I don't have much experience with it but I recommend checking it out.
update june 2018: also don't miss the ongoing rewrite of Weblocks, it's going to be huge ! :D http://40ants.com/weblocks/quickstart.html Weblocks allows to build dynamic webapps, without a line of Javascript, without separating the back and front. It is components-based, like React but server-side. It's very alpha as of writing (june 2018), but in progress, and it's working, I have a couple simple web apps working.
A simple way of get the request parameters (something like: get-get #key, get-post #key, get-cookie #key).
I found easier the Lucerne way, it iss as simple as a with-params macro (real world example):
#route app (:post "/tweet")
(defview tweet ()
(if (lucerne-auth:logged-in-p)
(let ((user (current-user)))
(with-params (tweet)
(utweet.models:tweet user tweet))
(redirect "/"))
(render-template (+index+)
:error "You are not logged in.")))
Caveman's way has been less clear to me.
Mysql access
Caveman advertises database integration (with Fukamachi's Datafly and sxql).
You can just use clsql or the Mito ORM: https://lispcookbook.github.io/cl-cookbook/databases.html
HTML Form generators, processing, validators, etc.
I don't know if there are form generators out there. edit: there are: cl-forms and formlets, or again 1forms, working with Caveman2.
Caveman does not have one (issue raised in 2011).
Helpers for filter user input data (something like htmlentities, escape variables for put in queries, etc).
Ratify is an input validation library, not integrated into a framework though.
FLOSS and GNU/Linux friendly: ✓
Other web stuff
Speaking about web, there are other nice libraries in CL land:
web servers: Woo is a fast HTTP server, faster than Nodejs (beware of charts…), wookie is an async http server,
Dexador is an HTTP client
Plump, lquery and CLSS make it easy to parse html and query the DOM.
cl-bootstrap offers twitter-bootstrap shortcuts for the cl-who templating engine (which kind of replaces Jade/Pug, even though we have usual templates too).
Ajax in Lisp
(remember, with Weblocks, see above, we might not need those)
With ParenScript, we can write JavaScript in Common Lisp, without living our usual workflow, and we can thus use the fetch web API to write Ajax calls.
Clojure would be perfect for this. With some very short, clean code, you can implement some very complex applications, such as blogs or forums.
You might want to consider the awful web framework for Chicken Scheme.
Natively supports PostgreSQL and SQLite
Built-in easy support for sessions
Shortcuts for some webdev idioms, like the (ajax) procedure
Your app can be easily compiled to a static executable (via csc -static) for easier deployment
The collection of all chicken libraries (eggs) isn't as versatile as in some other programming languages, but isn't awful either

What languages can be used to make dynamic websites?

So, there are several languages which will allow you to create a website, as long as you configure the server(s) well enough.
To my knowledge, there is:
PHP
ASP.NET
Ruby(on rails, what is
that all about?)
And thusly, my knowledge is limited. Ruby and ASP, I've only heard of, never worked with. If there are other languages, I suppose they have some way to make files containing the needed html. It would then suffice to add a line to the Apache config to associate the file-extension.
And if other languages: are there any notable characteristics about the one(s) you mention?
ANY language can be use to make a dynamic website - you could do it in COBOL or FORTRAN if you were twisted enough. Back in the olden days (about 10 years ago) most dynamic websites were done with CGI scripts - all you needed was a program that could read data from standard input and write data (usually HTML) to standard output.
Most modern languages have libraries and frameworks to make it easier. As well as the languages you have already mentioned, Java, C# and Python are probably the most common in use today.
Typically a web framework will have:
a way of mapping URLs to a class or function to handle the request
a mechanism for extracting data from a request and converting it into an easy to use form
a template system to easily create HTML by filling in the blanks
an easy way to access a database, such as an ORM
mechanisms to handle caching, redirections, errors etc
You can find a comparison of popular web frameworks on wikipedia.
How can you forget Java ? :)
Python
It runs on Windows, Linux/Unix, Mac OS X, and has been ported to the Java and .NET virtual machines.
Python is a perfect scripting language for web applications, e.g. via mod_python for the Apache web server. With Web Server Gateway Interface a standard API has been developed to facilitate these applications. Web application frameworks or application servers like Django, Pylons, TurboGears, web2py and Zope support developers in the design and maintenance of complex applications. Around libraries like NumPy, Scipy and Matplotlib, Python is a standard in scientific computing.
Among the users of Python are YouTube and the original BitTorrent client. Large organizations that make use of Python include Google, Yahoo!, CERN, NASA,and ITA.
This could be for your interest.
Virtually thru CGI all programming languages that produce output may use for web page generation.
Basically, you can use any language (if you are hosting your own server)
Very closely related and very interesting is this article where LISP has been used to build a very succesfull website.
Python has a 3rd party module CherryPy which can be used with or without a http server.
Amongst others: Erlang (YAWS, Mochiweb), Python
JSP has the advantage that it automatically wraps your code in a servlet, compiles that to bytecodes, then uses the just-in-time Java compiler to recompile critical sections into native object code. Not aware of any alternative which allows optimizes your work automatically in this way.
Also allows you to develop and deploy on any combination of Windows, Mac OS X, or Linux.
If you'd like to choose one for the beginning, you should check out PHP first. It gives you the basic clues about how dynamic sites work in general.
After you've become familiar with the basics, I recommend ASP.NET.
Fist off, you should know that ASP.NET is a technology and not a language. (It actually supports any language that can be used on the .NET platform.) Also it is not to be confused with classic ASP. (The old ASP was much more like PHP.)
ASP.NET is very easy to begin with, and after you have some clues about its concepts, you can always dig deeper and customize everything in it. The http://asp.net site is a very good starting point, if you are to learn it. I think it is really worth the effort, because even if you choose not to stick to it, it will give you some interesting ideas and concepts.
I tell you its most important advantages:
The code is compiled (and NOT interpreted like PHP), and it has a very good performance. (In a performace comparsion, it is 10-15 times faster. http://www.misfitgeek.com/pages/Perf_Stat_0809.htm)
It can be run on Windows without effort, and on Linux / Mac / etc using the Mono project.
It implements the Separation of Concerns principle very well.
It has most of the general functionality you'll need built-in. (Such as membership, roles, database management, and so on.)

Lisp Web Frameworks? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
What are the popular (ok, popular is relative) web frameworks for the various flavours of LISP?
PLT Scheme features a built-in, continuation-based web server.
Update: PLT Scheme is now called Racket.
Hunchentoot is also quite widespread
What is Weblocks?
Weblocks is a continuations-based web framework written in Common Lisp.
http://common-lisp.net/project/cl-weblocks/
Most (perhaps all) of the well-known Common Lisp web frameworks have already been mentioned, so I'll just add some comments.
Hunchentoot is not a "web framework" in the sense that most people mean. It's an HTTP server (an extremely good one).
Drew Crampsie's "Lisp on Lines" looks extremely promising, but I'm not sure how far along it is. I've been waiting to hear an announcement.
Marco Baringer's UnCommon Web runs on many of the prominent CL implementions: Allegro CL, CMUCL, Clozure CL (formerly known as OpenMCL), GNU clisp, and SBCL. The only major one missing is LispWorks; I don't know if that means it hasn't been tested to work, or is known not to work, or what; but if it runs on all those other dialects, it's probably easy to make it run on any other.
For Clojure you can try Compojure.
Common Lisp
A lot of the usual suspects (Hunchentoot, UCW, LoL) have already been mentioned.
Franz makes available for Allegro Common Lisp (and ported to other Lisps):
at a lower level (handling HTTP requests yourself), AllegroServe.
at a higher level (more of a "framework"), WebActions.
Both are open source. I tend to use AllegroServe, factoring out utilities as I need them, but some people really like WebActions.
I used Araneida for quite some time, and I prefer its style to AllegroServe, but it hasn't been maintained since 2006.
I've searched quite extensively for a good web framework for Lisp, and I found them all to be somewhat inaccessible. The Architecture of UCW didn't seem very natural to me (I can't remember why; it's been a while since I looked into it), and KPAX isn't maintained anymore (I think).
Symbolic web looks very interesting, and I think Weblocks is the most interesting, but Weblocks isn't very well documented and can be pretty intimidating to the newcomer. SymbolicWeb was immature last time I looked, but it may have grow up some since then. The features page looks pretty good today.
There are different approaches you could take. If you want a purely lisp approach, then you could:
If you can read code proficiently and understand continuations, you might try Weblocks with a Hunchentoot backend (Weblocks has a dependency on Hunchentoot that hasn't been abstracted yet). There is supposed to be a real user manual out in a month or two, but as with any OSS project, such commitments are sketchy.
Similarly, you might try SymbolicWeb. [update: nevermind, the project is no more]
roll your own. Seriously - there's cl-who to help with HTML generation, there are javascript and json libraries available, usockets, elephant, cl-sql, hunchentoot, aserve, and lots of utility libraries that you could bake together.
If you are ok with a hybrid approach, this is something I'm experimenting with at the moment: I've written a Lisp JSON-RPC backend for Qooxdoo, so I can serve up pure javascript frontends through a superfast http server like Cherokee and let Cherokee farm out connections to as many backend json-rpc servers running in Lisp as I want. Very, very scalable. I'm far from figuring out the kinks and challenges, but it was pretty straight-forward to get working. the json library makes it stupid simple to get the backend working - Qooxdoo itself is actually harder, I think (but I'm not a JS developer, really).
I'm also going to be checking out WebActions from allegro, because there's a certain allure to the availability of paid support - not to mention that Allegro may be the best CL implementation available (His Kennyness uses it :-)).
UnCommonWeb (UCW) is often mentioned http://www.common-lisp.net/project/ucw/ -- it's not REST as is in en-vogue at the moment, more like Smalltalk's SeaSide (but then again, SeaSide is quite en-vogue).
LeftParen
Lisp-on-lines is a web application framework built on top of CLSQL and UCW and provides an application development model similar in many ways to Ruby on Rails. Right now it can be found at http://versions.tech.coop/lisp-on-lines/.
http://www.cliki.net/lisp-on-lines
http://kevin.casa.cavewallarts.com/LISP/LOL/lol.html
For Clojure you can try Webjure.
I just discovered a web framework called Clack for common lisp and found it quite easy to get started.
See http://clacklisp.org/
Quote from it's web site
"Clack is a web application environment for Common Lisp inspired by Python's WSGI and Ruby's Rack."
and caveman is a micro web framework based on Clack.
Another cool (yet far from "popular") thing to look at is SymbolicWeb -- http://groups.google.com/group/symbolicweb
Re: SymbolicWeb (and its exaggerated demise)
SymbolicWeb project page at Gitorious and SymbolicWeb article at Wikipedia. The Google Groups page is definitely dead (and unarchived?,) but the Gitorious tree shows checkins as recently as 29 April 2010. The project page also refers to "some running examples" being "occasionally available" at nostdal.org (which is unreachable as I write this, reinforcing the "occasionally" qualifier :-) .)
(Note: I'm not a SymbolicWeb user. I just tracked down the SymbolicWeb links while reading this thread.)
Restas is another web framework that has seen recent updates:
http://restas.lisper.ru/en/
Its overview
RESTAS is a Common Lisp web application framework. Its key features are:
RESTAS was developed to simplify development of web applications following the REST architectural style.
RESTAS is based on the Hunchentoot HTTP server. Web application development with RESTAS is in many ways simpler than with Hunchentoot, but some knowledge of Hunchentoot is required, at least about working with hunchentoot:*request* and hunchentoot:*reply*.
Request dispatch is based on a route system. The route system is the key concept of RESTAS and provides unique features not found in other web frameworks.
The other key RESTAS concept is its module system, which provides a simple and flexible mechanism for modularized code reuse.
Interactive development support. Any RESTAS code (such as the definition of a route, a module or a submodule) can be recompiled at any time when you work in SLIME and any changes you made can be immediately seen in the browser. No web server restart or other complicated actions are needed.
SLIME integration. The inner structure of a web application can be investigated with the standard "SLIME Inspector." For example, there is a "site map" and a simple code navigation with this map.
Easy to use, pure Lisp web application daemonization facility based on RESTAS and SBCL in Linux without the use of Screen or detachtty.
RESTAS is not an MVC framework, although it is not incompatible with the concept. From the MVC point of view, RESTAS provides the controller level. Nevertheless, RESTAS provides an effective and flexible way for separation of logic and representation, because it does not put any constraints on the structure of applications. Separation of model and controller can be effectively performed with Common Lisp facilities, and, hence, doesn't need any special support from the framework.
RESTAS does not come with a templating library. cl-closure-template and HTML-TEMPLATE are two good templating libraries that can be used with RESTAS.
This question is a bit old but I thought I'd share my recent discovery: the Hop language which is based on Scheme and is quite complete.
HOP is a multi-tier programming language for the Web 2.0 and the so-called diffuse Web. It is designed for programming interactive web applications in many fields such as multimedia (web galleries, music players, ...), ubiquitous and house automation (SmartPhones, personal appliance), mashups, office (web agendas, mail clients, ...), etc.
HOP features:
an extensive set of widgets for programming fancy and portable Web GUIs,
full compatibility with traditional Web technologies (JavaScript, HTML, CSS),
HTML5 support, a versatile Web server supporting HTTP/1.0 and HTTP/1.1,
a native multimedia support for enabling ubiquitous Web multimedia applications,
fast WebDAV level 1 support,
an optimizing native code compiler for server code,
an on-the-fly JavaScript compiler for client code,
an extensive set of libraries for the mail, calendars, databases, Telephony, ...

Do you need a framework to write Ruby or Python code for the web?

Every time I see Ruby or Python discussed in the context of web development, it's always with a framework (Rails for Ruby, Django for Python). Are these frameworks necessary? If not, is there a reason why these languages are often used within a framework, while Perl and PHP are not?
I can only speak towards Ruby - but, no, you don't need a framework to run Ruby based pages on the web. You do need a ruby enabled server, such as Apache running eruby/erb. But, once you do, you can create .rhtml files just like RoR, where it processes the inline ruby code.
The short answer is no, they are not necessary. In ruby you have .erb templates that can be used in a similar way as you use PHP pages. You can write a site in ruby or Python using several technologies (Rails-like frameworks, Templates or even talking directly with the HTTP library and building the page CGI-style).
Web frameworks like Python's Django or Ruby's Rails (there are many) just raise the level of abstraction from the PHP's or ASP's, and automate several process (like login, database interaction, REST API's) which is always a good thing.
"Need" is a strong word. You can certainly write Python without one, but I wouldn't want to.
Python wasn't designed (like PHP was, for example) as a direct web scripting language, so common web-ish things like connecting to databases isn't native, and frameworks are handy.
EDIT: mod_python exists for Apache, so if you're merely looking to write some scripts, then Python doesn't need a framework. If you want to build an entire site, I'd recommend using one.
From a Pythonic point of view, you'd absolutely want to use one of the frameworks. Yes, it might be possible to write a web app without them, but it's not going to be pretty. Here's a few things you'll (probably) end up writing from scratch:
Templating: unless you're writing a really really quick hack, you don't want to be generating all of your HTML within your Python code -- this is a really poor design that becomes a maintainability nightmare.
URL Processing: splitting a URL and identifying which code to run isn't a trivial task. Django (for example) provides a fantastic mechanism to map from a set of regular expressions to a set of view functions.
Authentication: rolling your own login/logout/session management code is a pain, especially when there's already pre-written (and tested) code available
Error handling: frameworks already have a good mechanism in place to a) help you debug your app, and b) help redirect to proper 404 and 500 pages.
To add to this, all of the framework libraries are all heavily tested (and fire tested). Additionally, there are communities of people who are developing using the same code base, so if you have any questions, you can probably find help.
In summary, you don't have to, but unless your project is "a new web framework", you're probably better off using one of the existing ones instead.
Framework? Heck, you don't even need a web server if you're using Python, you can make one in around three lines of code.
As to the why:
The most plausible thing I can think of is that Perl and PHP were developed before the notion of using frameworks for web apps became popular. Hence, the "old" way of doing things has stuck around in those cultures. Ruby and Python became popular after frameworks became popular, hence they developed together. If your language has a good framework (or more than one) that's well supported by the community, there's not much reason to try to write a Web App without one.
A framework isn't necessary per se, but it can certainly speed development and help you write "better" code. In PHP, there are definitely frameworks that get used like CakePHP, and in Perl there are many as well like Mason and Catalyst.
The frameworks aren't necessary. However, a lot of developers think frameworks ease development by automating a lot of things. For example, Django will create a production-ready backend for you based on your database structure. It also has lets you incorporate various plugins if you choose. I don't know too much about Rails or Perl frameworks, but PHP frameworks such as Zend, Symfony, Code Igniter, CakePHP, etc are used widely.
Where I work at we rolled our own PHP framework.
Are these frameworks necessary?
No. They, like any 'framework', are simply for speeding up development time and making the programmer's job easier.
If not, is there a reason why these languages are often used within a framework, while Perl and PHP are not?
PHP and Perl were popular languages for building web sites well before the idea of using frameworks was. Frameworks like Rails are what gave Ruby it's following. I'm not sure that Python or Ruby were that common as web languages before they were backed by frameworks.
These days, even PHP/Perl web developement should be backed by a framework (of which there are now many).
By no means are those development frameworks required. But as with most development environments, your productivity will increase exponentially if you have a supported framework to reference and build your applications on. It also decreases the training needed to bring others up to speed on your applications if they already have a core understanding of the framework that you use.
For python, the answer is No you don't have to. You can write python directly behind your web server very easily, take a look at mod_python for how to do it.
A lot of people like frameworks because they supply a lot of the boilerplate code in a reliable form so you don't have to write it yourself. But, like any code project, you should choose the tools and frameworks on their merit for your problem.
You can certainly write CGI scripts in either language and do things "raw".
The frameworks (ideally) save the trouble of writing a pile of code for things that other people have already handled (session handling, etc.).
The decision probably comes down to what you need to do. If the framework has the features you need, why not use it. If the framework is going to require extensive modifications, it might be easier to roll your own stuff. Or check out a different framework.
The python library has numerous modules for doing cgi, parsing html, cookies, WSGI, etc:
http://docs.python.org/library/index.html
PHP has a lot of frameworks. Probably more then most. In Ruby most use Rails so thats what you hear, and Django for Python is mentioned more then not.
But with PHP you have many to choose from.
List of web application frameworks
Any language that can "print" can be used to generate web pages, but frameworks handle a lot of the HTML generation for you. They let you concentrate more on the content and less on the details of coding the raw HTML.