Common Lisp Utilities

Provides nlet (a Scheme-style let), bcond (a Scheme-style cond which allows the result of the condition to be passed to the consequent clause), as well as a few other functions. Also a generalized reference system, so you get get and set into lists, arrays, strings, hashtables etc polymorphically.

nlet is a version of the Scheme named-let construct. nlet correctly handles the case where the function is called from tail position (even in a non-tail-recursive compiler), and correctly handles the situation where the function escapes. What it does not handle correctly is the case where it is called from a non-tail position (nlet will compile this as though it were in tail position anyway). The way I tend to use nlet, it's almost always called from tail position. If I really need to do non-tail call, (funcall <name> <parm1> <parm2> ...) will do the trick, albeit somewhat clunkily.

bcond is a version of Scheme's cond, which allows the consequent clause to bind the test expression using the => syntax (bcond is an abbreviation for Binding COND). It goes to a fair bit of trouble to do this in an efficient manner. If the consequent is a lambda expression, it will inline the lambda body. If the consequent is not a function, then it doesn't bother catching the test value. It currently doesn't handle multiple values correctly; and although the fix for this isn't that big a deal, it does impose a performance penalty on some (all?) architectures. I may enhance bcond to allow ==> to indicate that the multiple-value-bind should be used.

Get the code for the basic utilities here.

ref is library implementing generalized accessors for indexing into arrays, bits, lists, strings, hashtables without really caring what it is. It is extensible for user-defined collections as well. There is a skeleton of the rest of a generalized container system, but it needs to be fleshed out.

Also included is a portable locative facility, built on the generalized accessor framework. It's not quite a replacement for the lispm locative feature, but serves some of similar purposes.

Suggestions, criticism, and additional contributions welcome.

Get the code for the generalized collections and portable locatives here .


Michael Parker
Hosted by www.Geocities.ws

1