Where to learn how to practically use Common Lisp [closed]

Solution 1:

I would propose reading 'Practical Common Lisp', since it already answers some of your questions.

There are probably three to four books you should read:

  • Basic introduction to Common Lisp: Common Lisp: A Gentle Introduction to Symbolic Computation
  • Practical introduction to Common Lisp: Practical Common Lisp
  • More advanced Common Lisp: Paradigms of Artificial Intelligence Programming: Case Studies in Common Lisp. The book is interesting also for non-AI programmers.
  • Lots of practical advice: Common Lisp Recipes.

Common Lisp Reference

  • Reference: Common Lisp HyperSpec
  • Printable Quick Reference: Common Lisp Quick Reference
  • Search Engine for Documentation
  • L1sp.org - redirect service for documentation

Manuals

Now the next thing you should check out is the manual of your Lisp implementation. It describes a lot of specific extensions: networking, threads, ...

Documentation for Common Lisp implementations:

  • Allegro Common Lisp
  • CLISP
  • Clozure Common Lisp
  • CMUCL
  • ECL
  • LispWorks
  • SBCL
  • Scieneer Common Lisp

SLIME (the Emacs-based Lisp-IDE) has a SLIME User Manual.

Documentation for Common Lisp libraries:

  • Quickdocs

Libraries

For libraries use

  • Quicklisp: supported Libraries.
  • CLIKI (gives some overview)

Now looking at some of your points:

  • How to read files

See the files and streams dictionary in the HyperSpec. WITH-OPEN-STREAM, READ, READ-LINE, READ-CHAR, READ-BYTE, READ-SEQUENCE, ...

  • How to read a file, replace words in the file, and write the result back to the file

Use above. See also: WRITE and related.

  • Iterate the files in a directory and other filesystem stuff

See above. DIRECTORY, pathnames, ...

  • Interact with an SQL db

Use for example the CLSQL library.

  • Do communications over sockets

See the manual of your Lisp or use one of the portable libraries. See Quicklisp.

  • Threading for stuff like a webserver

See the manual of your Lisp or use one of the portable libraries. See Quicklisp.

  • Create GUIs

Depends. See Quicklisp or an implementation specific library.

  • Perform operations on binary files

See Hyperspec for file and stream operations. WRITE-BYTE, READ-BYTE. Open a stream as a binary stream.

  • Write a parser (not an interpreter for Lisp in Lisp, which as I understand is like 5 lines of Lisp)

Use one of the existing tools for that. Study existing parsers. There are many parsers written in Lisp, but not much in books about that (other than natural language parsers, which are described in the AI literature).

  • Interact with the operating system (i.e. stuff written in C or C++) to do stuff Lisp can't do natively

Depends. See Quicklisp or an implementation specific library.

  • How to write Lisp extensions in C (is that possible?)

Depends. See Quicklisp or an implementation specific library. -> FFI

Final advice: Read code from other authors.

Study other Lisp code. There is enough very diverse Lisp code out there. From web servers to music composition software.

Solution 2:

Check out Cliki the Common Lisp wiki it provides a list of libraries available for Common Lisp which will help you accomplish all your items.

Also, you're going to want to check out the Common Lisp Cookbook (there's also a more updated version). It has a bunch of code for common tasks such as reading a file one line at a time, and Foreign Function Interfaces for interacting with libraries written in C.

You can write extensions for Lisp in C depending on which implementation you're using. Emacs-Lisp for example allows you to do that though it isn't Common Lisp. Usually what you want to do is write the code in Common Lisp and then optimize it as much as possible using different Lisp compiler declarations, or the other method where you use a foreign function interface.

Threading depends on which implementation you use, but I think most of them have threads now.

Hunchentoot is one of the best Lisp web servers and is pretty easy to get started with. You don't have to write any threading code yourself, you just have to write the HTTP request handler functions.

Someone compiled a list of GUI options for Lisp:

  • cl-gtk2, an interface to the GTK gui library
  • McClim
  • Garnet
  • Common Qt
  • EQL