Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
97 lines (67 sloc) 4.05 KB

My Toolbox Library

This is a collection of some functions, macros, and a few reader macros I have collected over the years. It started as a merely copying the code from Paul Graham’s text On Lisp, but has slowly grown in scope and utility. Most of the stuff from On Lisp remains unchanged in on.lisp (clever, right?) and a few of the more complicated bits found their ways to their own files.

Although this was not always the case, at this point I see this as a staging area for ideas that seem interesting and useful enough that I will want to use them in multiple projects, but are not thought out enough, or significant enough to warrant a separate library. If I am not too lazy, these utilities work their way into separate files and, eventually, into separate packages. Judging by the size of the library, this has not happened enough.

I’d like to use this library

Don’t.

My suggestion is to take the bits you like and make a library of your own. Better yet, if you turn a piece of this into something that is general purpose, publish it and please let me know. I will remove the functionality here and use your library as a dependency (like I did with Infix, Alexandria, CL-Primality, and others).

Note that the licensing here is a bit weird, see the last section, but my stuff is non-copyleft Free Software, so feel free to use it for whatever.

What’s in it?

Right now it consists of several files:

on: Paul Graham’s collection of simple functions and macros from On Lisp. Some omitted.

dbind: Graham’s fancy DESTRUCTURING-BIND implementation.

applied: A holding place for the very complicated parts of On Lisp, like the lazy evaluator, the continuation system, and the “Query Compiler”. Basically a resting place for stuff that need more than 2 functions to work.

anaphoric: A wrapper around Anaphora. Basically adds Graham’s extra anaphoric constructs on top of the Anaphora ones.

b-io: A little binary I/O facility I put together for work. Not sure how well it works really, especially in respect to moving between architectures.

combinatorics: Simple math like permutations and combinations

compat: A simple portability wrapper for things like commands line arguments and a QUIT function.

fcase: CLISP’s FCASE macro so other implementations can use it as well.

misc: Where I put most new stuff I think of. This way I don’t need to categorize as I code.

mvb: Some short aliases for MULTIPLE-VALUE-BIND and friends.

number-theory: Some number theoretic algorithms like EXPT-MOD and *-MOD. The prime number stuff has been moved to its own library, Cl-Primality (also see Cl-Factoring for a factoring library).

numerics: A holding space for stuff that has to do with floating point arithmetic and numerical analysis (like root finding).

iterate: Some extensions for Iterate that make it a bit more powerful/useful.

string-algs: Some common algorithms for strings, like Levenstien distance and Longest Common Subsequence (LCS).

Portability

I don’t really test this library for portability, or at all. I do however, use several parts of it commonly from an assortment of the FOSS Lisp implementations and rarely have issues. My guess is that it is quite cross implementation except for the bits that aren’t (the ones littered with implementation dependent conditional macros).

License

As stated, most of this is not mine at all, but rather a big chunk of stuff from the book On Lisp and a few things I’ve aggregated from around the Internet (and a few original bits). As such, the license is probably quite complicated as it probably depends on what the original author intended. I tried to give hints as to the origin of the code in the source. For the stuff I did, I will use a 3-clause BSD license.

FCASE is directly taken from CLISP, which means it is under some version of the GPL.

The stuff in On lisp is under whatever license PG wanted.

I tried to note where I took various pieces that I didn’t write either in the file or in the commit message for that piece of code.