Wasif Hyder
Wasif Hyder

Reputation: 83

Lisp - Is it good for web programming/applications (interactive) ? The way ruby is ? The way php is?

Is Lisp good for web programming/applications (interactive), the way ruby and php are?

Things to take into consideration would be:

(Edit) I was Particularly referring to Common Lisp, after reading Paul Graham's essay. Would be my first programming language. In this regard. Is it suitable to do so ?

I hear that Clojure's macro functionality is not as powerful as Common Lisp's, and that's why I'm trying to learn Clojure. It teaches programming and is very powerful.

Upvotes: 8

Views: 1461

Answers (5)

Mamun
Mamun

Reputation: 512

For web application, framework is important consideration than language. If language is very powerful but don't have good web framework, developing web application immediately become hard and face lot of known complexity.

Think about ruby without rail framework, people start to like it because of rail framework. This is same as java, using only Servlet without Jsp or other framework developing web application will be horrible.

Now come to your point, easy of use always relative- I could not find any end to end framework in LISP family like ruby or python. But I found Clojure reduce lot of complexity in server side. Deployment- it depends on server, not language like java server need war or ear file. Learning- it is also relative but tools some times help like debugging or ide. But most of the lisp family don't have good debugging option.

Upvotes: 0

Agis
Agis

Reputation: 33626

This is opinionated but so is the nature of the question, so here's my take.

I would not recommend a beginner to programming to start with a functional language, especially a Lisp.

T concepts on functional languages and especially Clojure are more advanced and the power it gives you, you propably won't need in your first steps into web development.

So since you are a beginner, then my answer would be no, Lisps are not as easy to learn and use as Ruby and PHP are.

Upvotes: 0

Brendan Foote
Brendan Foote

Reputation: 1388

There's a funny quote from Kent Pitman

"...Please don't assume Lisp is only useful for Animation and Graphics, AI, Bioinformatics, B2B and E-Commerce, Data Mining, EDA/Semiconductor applications, Expert Systems, Finance, Intelligent Agents, Knowledge Management, Mechanical CAD, Modeling and Simulation, Natural Language, Optimization, Research, Risk Analysis, Scheduling, Telecom, and Web Authoring just because these are the only things they happened to list."

And, look, "web authoring" even made it on the list!

Lisp is good for web programming because it is so flexible and the s-expressions that make up Lisp forms have some nice similarities to HTML. To see what I mean, check out Lisp for the Web. Notice how he writes a macro to basically create a domain-specific language for creating web pages -- instead of defining functions, he's now defining pages! This DSL concept is also apparent in the CL-WHO library he's using, which lets you write Lisp that turns into HTML.

Paul Graham had success rolling his own solution while creating what later became Yahoo! Store in Common Lisp (and even more success writing about it afterwards), and since then many packages have sprung up.

Weblocks is the Common Lisp web framework that seems to me to have the most momentum at the moment. There's a video of it being discussed at the Twin Cities Lisp user group. UCW is very similar, but I don't see much action on it now (please excuse me if I'm just looking in the wrong places). The blog post on why the creator made Weblocks is pretty enlightening: he basically wrote enough Lisp so that he'd never have to deal with HTML, AJAX, and JavaScript again. That might be an overstatement, but the fact that he could even do some of that should answer your question.

Upvotes: 3

Svante
Svante

Reputation: 51501

I have almost no experience with PHP or Ruby. However, I can say that it is quite easy to write a web application using Hunchentoot, CL-WHO, and one of the many database backends (Postmodern, CL-SQLite, CLSQL, or even a simple serialization library like USerial or Rucksack).

There are also frameworks like Uncommon Web or Weblocks, but I have not tried them yet.

Upvotes: 7

Michael Kohl
Michael Kohl

Reputation: 66837

Lisp is a language family, not a single language. To somewhat answer your question, yes, web frameworks exist for the various Lisp dialects, like UnCommon Web for Common Lisp and PLT Racket (a Scheme dialect) has a tutorial on their web site too:

http://docs.racket-lang.org/continue/

But one Lisp dialect where you'll see quite a lot of web development going on at the moment is Clojure, since it can leverage existing Java libraries and infrastructure. Here's a list of projects, and that's not comprehensive:

  • Hiccup - represent HTML in Clojure
  • Ring - a HTTP abstraction similar to Rack in Ruby
  • Enlive - selector based templating and more
  • ClojureQL - a SQL integration library
  • CongoMongo - a wrapper for MongoDB

There'd be many more, but I think you get the idea. As for Clojure web apps in the wild, the Clojure learning site 4Clojure would be an example and you can check out the source code on GitHub (I occasionally contribute to this):

As you can see there's quite a lot going on in terms of Clojure and web development. It may not always be smooth sailing, but people are working fast at making the experience better. Making use of existing Java infrastructure does have its benefits, like the possibility to deploy to Google App Engine etc.:

http://www.infoq.com/articles/deadline-clojure-appengine

Hope that somewhat answers your question...

Upvotes: 13

Related Questions