Skip to main content

Chapter 18: Libraries

  • Chapter
  • 2029 Accesses

Abstract

There used to be a time, not so long ago, when people complained about the Common Lisp library situation (and rightly so). It was perceived that—compared to more popular languages like, at that time, Perl—there weren’t “enough” libraries available, and it was hard to find those that were. And, once you had found one, it was hard to install or it didn’t play nicely with your specific implementation. Fortunately, those days are over and we now have an abundance of libraries, which are very easy to obtain and compatible with the prominent Common Lisp compilers.

This is a preview of subscription content, log in via an institution.

Buying options

Chapter
USD   29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD   79.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD   99.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Learn about institutional subscriptions

Notes

  1. 1.

    Which implies that nobody is stopping you from nesting modules. So, components of a module could themselves be modules, which again could contain modules, and so on.

  2. 2.

    It had better be acyclic, because otherwise, your system would never build!

  3. 3.

    One could argue that the relation is also reflexive in the sense that each file depends on itself; it must first be compiled before it can be loaded.

  4. 4.

    But you can also introduce subtle errors if you forget to state some dependencies!

  5. 5.

    Which also implies that in this case, the order of components in the system definition matters, while otherwise it doesn’t.

  6. 6.

    You’re scratching your head because the files are named by strings and the Drakma system is named by a symbol? Read Recipe 1-9.

  7. 7.

    Make sure that it really denotes a directory. A typical error is to forget the slash at the end.

  8. 8.

    Or ~/.local/share/common-lisp/source/ for older versions of ASDF.

    Here ̃ means your home directory on Unix-like systems, as usual. But it is more complicated on Windows. At the time of this writing, your best bet is to look at the output of the (unexported) function ASDF::DEFAULT-SOURCE-REGISTRY to find out where ASDF looks by default on your particular machine.

  9. 9.

    There are similar repositories for other languages, but these two are the oldest, and in their heyday, they were very successful. In fact, many people argue that CPAN was maybe the most important factor for Perl’s immense popularity in the 1990s and the first years of this century.

  10. 10.

    Don’t worry about the “beta” there. Quicklisp has been around since 2010 and it works just fine. For the reasons why it’s still “beta,” see http://lispblog.xach.com/post/122948651818/quicklisp-beyond-beta .

  11. 11.

    Actually, the better advice is to follow the instructions you’ll see on the screen. Quicklisp will guide you through the installation process and this will presumably still work, should this book be outdated at some point in the future.

  12. 12.

    To be found at http://quickdocs.org/ and http://cliki.net/ , respectively.

  13. 13.

    Which is, of course, available via Quicklisp (see Recipe 18-2).

  14. 14.

    See https://en.wikipedia.org/wiki/Partial_application .

  15. 15.

    Also, due to different diagnostic capabilities and compilation strategies (see Recipe 17-15), different compilers might be able to point out different flaws and weaknesses of your code. It might thus be a good habit to run your code on different Lisps from time to time.

  16. 16.

    Which is, of course, available via Quicklisp (see Recipe 18-2).

  17. 17.

    Positions are meant to be understood as in SUBSEQ(see Recipe 7-5).

  18. 18.

    The regular expressions used in most programming languages today are much more powerful than the ones that were originally used to describe so-called regular languages, though.

  19. 19.

    This is, for example, the case with CLISP, AllegroCL, and LispWorks.

  20. 20.

    It is probably worth noting that in spite of the similarity in name, CL-PPCRE is not in any way related to the popular C library PCRE. In particular, it doesn’t employ this library but is rather written in pure Common Lisp.

  21. 21.

    If, however, you know the basics but need a refresher, you might want to have a look at The Regex Coach (to be found at http://weitz.de/regex-coach/ ), which is based on CL-PPCRE. In terms of downloads, it is certainly one of the most popular Common Lisp applications ever written.

  22. 22.

    Except for arcane differences described in the CL-PPCRE documentation the syntax coincides with the one found at http://perldoc.perl.org/perlre.html .

  23. 23.

    If you’re a dyed-in-the-wool Perl hacker and plan to use CL-PPCRE regexes a lot, you might want to have a look at the CL-INTERPOL library, which will relieve you of the need to always type two backslashes.

  24. 24.

    The full syntax is described in the CL-PPCRE documentation.

  25. 25.

    Ok, so you’re nosey. They are closures, or rather “chains” of closures.

  26. 26.

    Although the closures themselves employ some Lisp-y techniques, the idea of processing a regular expression before it is used is far from being original or revolutionary. It’s what pretty much every regex engine does. Some call this “compilation” of the regular expression, some use other names.

  27. 27.

    Of course, PPCRE:SCAN provides more information. Here you can’t see just from looking at the results, where in the string the "oo" came from or whether the "o" was the first or the second character of the match.

  28. 28.

    This also demonstrates an S-expression regex (see above).

  29. 29.

    They compute the digital root (see also page 79) of their argument (which should be the string representation of an integer written in decimal notation) and will tacitly skip all non-digit characters.

  30. 30.

    See https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol .

  31. 31.

    The reason for using the flexi-streams library (see Recipe 3-3) in this case is explained in the Drakma documentation.

  32. 32.

    See http://www.cliki.net/html%20parser .

  33. 33.

    A port of the parser that comes with AllegroCL.

  34. 34.

    We are using a keyword argument to instruct Hunchentoot to listen on port 4242. The default port is 80, which is the standard HTTP port, but with most modern operating systems, you won’t be able to use it unless you are running your Lisp with admin rights.

  35. 35.

    See Recipe 22-9 for GET-UNIVERSAL-TIME.

  36. 36.

    By John C. Mallery, see https://en.wikipedia.org/wiki/CL-HTTP .

  37. 37.

    See http://www.cliki.net/web for an overview. If you want a super-fast Lisp web server, have a look at Woo by Eitaro Fukamachi, see https://github.com/fukamachi/woo .

  38. 38.

    You can have several active acceptors at the same time, but only one per address/port combination.

  39. 39.

    You can be more flexible, though, and provide a test function instead of a string so that one handler can be made responsible for a whole class of resources.

  40. 40.

    For alternatives see http://www.cliki.net/templating%20library .

  41. 41.

    For alternatives see http://cliki.net/html%20generator . In the examples mentioned above, Hunchentoot uses CL-WHO.

  42. 42.

    See for example http://www.cliki.net/web%20framework for an overview.

Author information

Authors and Affiliations

Authors

Electronic Supplementary Material

Below is the link to the electronic supplementary material.

chapter-18 (zip 2 kb)

Rights and permissions

Reprints and permissions

Copyright information

© 2016 Edmund Weitz

About this chapter

Cite this chapter

Weitz, E. (2016). Chapter 18: Libraries. In: Common Lisp Recipes. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4842-1176-2_18

Download citation

Publish with us

Policies and ethics