How can I do web programming with Lisp or Scheme?

后端 未结 14 827
遇见更好的自我
遇见更好的自我 2021-01-29 18:35

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 enviro

相关标签:
14条回答
  • 2021-01-29 18:50

    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.

    0 讨论(0)
  • 2021-01-29 18:52

    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.

    0 讨论(0)
  • 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.

    0 讨论(0)
  • 2021-01-29 18:55

    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.
    0 讨论(0)
  • 2021-01-29 18:56

    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.

    0 讨论(0)
  • 2021-01-29 18:57

    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:

    1. Use SBCL on Linux but with multiple thread support
    2. Use Hunchentoot as a web server which will provide you with all the server processing required including sessions and cookies
    3. Use ClSql to communicate with MySql it has ample documentation and is very stable.
    4. 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)

    0 讨论(0)
提交回复
热议问题