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

5

8

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

Things to take into consideration would be:

  • Ease of use
  • Deployability
  • Difficulty (especially for a beginner to programming)

(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.

Cushiony answered 30/4, 2011 at 10:44 Comment(2)
I'd be shocked if there's a single language this isn't true of. Some lunatic made COBOL on Cogs if that gives you any indication of how prevalent web frameworks are these days.Steenbok
Check out the question on the difference between Common Lisp and Clojure macros: #9612321Lavonna
S
13

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...

Stockist answered 30/4, 2011 at 11:30 Comment(2)
It Does :) Thank you. I was talking about common lisp. Do you know how Clojure compares to Common Lisp ? Im a beginner. I found Peter Norvig's Paradigms of Artificial Intelligence. And Land of Lisp on Amazon. Common Lisp has Macros and Other Powerful Features that make programming really powerful. How easily would I be able to transfer my knowledge of Common Lisp to Clojure ? and be able to actually use the same techniques I learnt in Common Lisp ? I heard that Clojure does not implement the macros quite well.Cushiony
Apart from the obvious Lisp-1 vs Lisp-2 differences, there are certain differences in programming paradigms (Clojure favors the functional paradigm, CL is a bit more open in that regard), but you'll still be able to transfer a lot of what you learned to Clojure. Macros are a topic of endless debate, ask the Schemers about hygienic macros ;-) Clojure's macro system is pretty good though, so don't worry :-)Stockist
S
7

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.

Septillion answered 30/4, 2011 at 12:44 Comment(0)
L
3

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.

Lavonna answered 27/2, 2013 at 20:26 Comment(0)
U
0

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.

Ureter answered 7/3, 2014 at 9:38 Comment(0)
S
0

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.

Stortz answered 7/3, 2014 at 16:9 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.