There seems to be an interesting attraction between Erlang and Lisp and several times it has been tried to marry them, in different ways. Bill Clementson wrote about it already in his article Concurrent/Parallel Programming - The Next Generation. Here is an updated list:
And this list does not even include projects like (again defunct?) Kali Scheme, which are clearly related.
Personally, I think that the reimplementation approach will have a tough stance against integration approaches like Distel. They lock out either one or the other of the two language eco-systems: libraries, development tools, etc., and recreating this is a lot of work (but don't let that stop you!) With Distel, I can choose to program parts of the application in ELisp or Erlang, whatever is a better fit.
Distel implements Erlang's on-the-wire protocol, which is nice because there is no need to mess around with a Foreign Function Interface. Alternatively, one could bind to the Erlang C libraries. As far as rapid prototyping is concerned, this should be the fastest and most straight-forward approach. I wonder why everybody is doing it the hard way?
Bill Clementson wrote a nice summary of the Erlang Interoperability options. Thanks again, Bill!
One of the bigger challenges with deploying dynamic web servers is being able to cope with load peaks that happen when the URL is communicated to larger communities in a short time. I have seen several sites being slashdotted and collapse under the load, and it is common to blame the underlying server technology for crashes; being Lisp lovers, we don't want to see that happen for our sites.
Following industry practice, we have been using a caching reverse proxy in front of our Lisp based dynamic web servers from the beginning. Our choice was Squid, as I had prior experience configuring it and found it to work reliably once the configuration was in place. I was never quite happy with that choice, though, because Squid's main operation mode is forward proxying. It has gazillions of configuration options that are not needed for a reverse proxy, which made us feel that Squid would not be a perfect match for our demands.
This is not to say that Squid has hurt us in any way. It has served us well during a load peak on the create-rainforest web site, but as reverse proxying has become very common in the last few years, we found it about time to go shopping for a solution that might be a better match to our needs.
We hoped to find a frontend proxy having the following features:
varnish seems to have most of the features that we require: It supports caching, has been tested under very high loads and supports FreeBSD which is our deployment platform. Varnish has been written by Poul-Henning Kamp of FreeBSD fame, so we also found it to be culturally compatible.
Our evaluation revealed that varnish is under active development and support, and we found the developers be very responsive to our bug reports and requests. Its architecture looks well thought out, and the configuration language (even if underdocumented) makes the request handling process very transparent.
There are a number of downsides with varnish, though:
We would have liked to switch to varnish because of the very good support and because it is meant to be a web frontend, nothing else. Yet, at the current point in time, it does not seem to be mature enough to serve our needs. After having evaluated it, we turned back to squid as it seemed to be the only other option. We found that squid meets our requirements for cache cleaning and revalidation of cached objects very well.
Chosing a front end software is only part of what needs to be done to make a web system fast and robust enough to withstand high loads. The most important factor is to make the frontend serve a large percentage of the incoming requests from its cache and only consult the backend server for content that is really dynamic. The HTTP/1.1 protocol provides for request and response headers that control how content can be cached, and there is little need for explicit configuration if these headers are used correctly.
One way to limit the traffic to the backend is implement the If-modified-since mechanism. It is supported by Hunchentoot for static files by default, and can also be used for dynamic handlers that can check whether a resource has changed since it had previously been requested. Varnish will set the If-modified-since header when it requests resources that it already has in the cache, so every cacheable resource will normally be transfered from the backend to Varnish only once.
Often, resources are dynamic, yet it is not crucial that every client sees the absolutely latest version of the resource. For example, in our square meter sales application, visitors should always see the current number of square meters sold, but it is not vital that this information is accurate to the second. Thus, we want the cache to refresh such pages only at a certain interval. The HTTP/1.1 provides for the cache-control directive and in particular the max-age parameter. It specifies how long a cache may consider a cached resource be valid without revalidating with the originating server. By setting this parameter in responses sent by the backend, we can effectively limit the maximum refresh rate for dynamic resources that do not need completely up to date every time.
In order to test the performance of a Web system, it needs better tools than the often-used ApacheBench tool, which only tests response times and throughput of a single URL. For meaningful results, one should simulate a user load that reflects the load that real users create. I have been using SIEGE for informal testing often, as it is easy to use, but I have also found it a little flakey and prune to random crashes, which made us look for more reliable solutions.
In the FreeBSD ports collection, we found tsung. Tsung is an open-source multi-protocol distributed load testing tool written in Erlang, and it has good support for HTTP. In addition to running load tests against web servers and generating statistics reports, it supports a session recorder that can be used to create a log of the URLs that a user visits when browsing a web server which can then be directly used to simulate many simultaneous users. As an added bonus, it is possible to capture dynamically generated information from web server responses into variables and use them in subsequents requests in a session. This feature can be used to generate sale transactions or user registrations in a load simulation.
Using tsung and squid, we were able to tune our Lisp backend so that all non-dynamic content is served from the cache, pinpoint a serious performance problem and simulate realistic loads. We are now confident that our setup can withstand the next rush of users without crashing.
Shadowing functions is useful for example when testing.
Suppose we want to build a tiny test suite around the following function:
(defparameter *appointment* ...) (defun overdue-p () (>= (get-universal-time) *appointment*))
Testing OVERDUE-P obviously requires us to test two branches: one where the appointment is overdue and one where it is not.
Let’s say that you can’t change *APPOINTMENT* in your testing context for whatever reasons (the reason here being that this example is ultra-contrived for simplicity).
Assuming a fixed value for *APPOINTMENT* we need to change the return value of CL:GET-UNIVERSAL-TIME. This can be achieved by shadowing this function for the duration of our test.
Unfortunately, shadowing a function in Common Lisp isn’t obvious.
You can’t use FLET or LABELS because they have lexical scope.
You can’t use DEFUN either because it affects the global function namespace and doesn’t let you save or restore the old definition.
The only way I know of is using the function (SETF FDEFINITION):
(let ((orig (fdefinition 'get-universal-time))) (setf (fdefinition 'get-universal-time) (lambda () *my-testing-time*)) (prog1 (overdue-p) ; you'd run some test checks against the result here (setf (fdefinition 'bar) orig)))
Wrapping this in a macro is left as an exercise to the reader.
This doesn’t work for special operators, and neither for FLET or LABELS. See the CLHS entry for accessor FDEFINITION.
I pushed out Vecto 1.3.1. New in this version:
Many thanks to Ben Deane for providing a functional fill patch that made adding gradients much easier, and for suggesting the text-to-paths functionality. Thanks also to Jakub Higersberger for showing me how easy gradients could be. (I wound up using a very simple formula straight from the Adobe PDF Reference.)
This uses a simple white-to-transparent gradient:
Here's some code that uses all three new features:
(defun text-paths (file)
(with-canvas (:width 400 :height 100)
(set-font (get-font "/tmp/font.ttf") 70)
(centered-string-paths 200 15 "Hello, world!")
(set-line-join :round)
(set-line-cap :round)
(set-line-width 3)
(set-dash-pattern #(0 5) 0)
(stroke-to-paths)
(set-gradient-fill 0 0 1 0 0 0.5
0 100 1 1 1 1)
(fill-path)
(save-png file)))
I fell short of exporting and documenting the functional fill option that enabled gradients, because I've run out of time. Maybe next release!

The other day, I discussed languages which I thought were timeless. Among them, I listed Lisp, C, and Forth. After writing that posting, I spent some time playing with Forth again. Today, while browsing Reddit, I stumbled on this interview with Charles Moore, the creator of Forth.
Forth is one of those languages, like Lisp, that I'd recommend that everybody study at least for a time. Even if you don't walk away believing it's the Language to End All Languages, you'll be better off for the experience. In fact, Forth shares a lot of fundamental attributes with Lisp while at the same time appearing almost completely different to a programmer writing code.
Some of the shared attributes include:
All that said, Forth and Lisp are also very different:
Note that people have proposed systems which bridge between the two worlds. Factor is basically a Forth stack machine and syntax, augmented with high-level, Lisp-like data types and a GC. The result is a system which delivers Forth-like syntax with a Lisp-like debugging and development environment. Depending on your point of view, you'll either think this is the best of both worlds or the worst.
For me personally, I like both Forth and Lisp, but I'd use them in completely separate domains. If I was working on a deeply embedded project, where I'd want to be close to the machine architecture and where I had only a few KB into which to implement the program, I'd choose Forth. If I was writing a large application that would be running on a server with GBs of memory, I'd choose Lisp. Each works well within its target domain and the advantages of each are nearly the same: a small, extensible language with an iterative, interactive development environment.
As for systems like Factor, for me it's a "tweener" that doesn't fit my needs. By getting away from the machine details, adding high-level data types, GC, etc., Factor necessarily pushes itself out of the embedded world. You simply won't have microcontrollers running Factor. And if I'm going to be running on a system with an underlying operating system, a large graphical display, and GB of memory, I'd rather do my development in Lisp. While I like Forth, I find that Lisp's sexpr notation more closely matches my thinking model. With Forth's implicit stack, I have to be thinking all the time about what data values are at what positions on the stack. I'd choose to deal with that for an embedded design to get all the other attributes of Forth in that environment, but with fewer constraints, I'd choose Lisp over a "Forth with high-level data types and GC" like Factor.
Now, that's just me. For you, Factor may be the ticket. Slava Pestov is not an idiot (and you can quote me on that, Slava). As Factor's creator, he has obviously built a system that works well for him. Other people who seem to have far better programming skills than I do are working with Factor, too. The development environment they have put together seems to have borrowed a lot of ideas from Lisp machines, and I could see the Factor environment being really productive.
Whatever you choose, realize that all of these languages have some things they share. And fundamentally, both Lisp and Forth are timeless.
The other day, I realized that there wasn't a great place to discuss Lisp that was using a post-Y2K sort of interface. Sure, comp.lang.lisp has been around forever, and through Google Groups it has an HTTP interface, but when you post to Usenet you become an instant spam magnet. And new users think an all text-mode interface with no markup is just so 1985. And yes, there's always #lisp on Freenode.net IRC, which is great for realtime, but bad for searching for coherent answers.
So, I created Lisp Forum: www.lispforum.com
The content is a bit sparse right now. That's where you come in. Please register, hang out, and participate. My goal is to make this a friendly place with a bit less Smug Lisp Weenie-ness than comp.lang.lisp, suitable for both newcomers and old pros.
Simple-HTTP is a fork of Brian Mastenbrook’s trivial-http. If you need a serious HTTP client with all the trimming, you should look at Edi Weitz’s Drakma. On the other hand, if all want is a some basic HTTP support and don’t want to deal with lots of other dependencies, then simple-http may be something that meets your needs.
(P.S., the website needs a bit of love… Well to be honest, all my websites need some work but simple-http’s needs tough love!).
I came across geohash.org while browsing the Semantic Web last night. This site uses a simple latitude/longitude encoding to convert locations into short strings. Here, for example, is the URL for my house.
http://geohash.org/drs3nbcszvze
The nice thing is that strings with common prefixes are geographically close to one another. I saw that there were several ports of the algorithm to Ruby, Perl, PHP, etc. but no Common Lisp love. The geohash system on Common-Lisp.net fixes that! Enjoy
Planet Lisp is now on a new server. If you notice any problems with it, please email me.
Doing some more cleanup; the biggest improvement is that lift:with-timeout is now supported in SBCL with and without threads. The non-threaded version uses timers; I like ‘em.
moved file-newer-than-file-p from here to metatilities-base
did a whole bunch of symbol unexporting and exporting between here and metatiliites
metatilities-base (0.6.3)
added pathname-samep and moved file-newer-than-file-p from metatilities to metatilities-base.
did a whole bunch of symbol unexporting and exporting between here and metatiliites
lift (1.5.0)
improved while-counting-repetitions and while-counting
implemented with-timeout for SBCL without thread support (yeah!)
added errorp argument to find-testsuite and find-test-case
Enjoy.
When benchmarking, it is all too easy to use the Common Lisp [time][time] macro to see how long something takes. For example,
(time (dotimes (i 1000) (do-my-function)))
There are at least two problems with this simple approach. Firstly, time doesn’t make it easy to record the values it computes; secondly, if your function is very fast, you may end up timing how quickly your lisp execute dotimes rather than measuring what you want. A better way to approach this sort of question is to ask “how many times can I execute my function in, e.g., 5-seconds?” The only downside of this approach is that it takes a little more code to set things up. Once you have the code, however, Bob is your uncle. [LIFT][] includes a small (and sadly under-documented) selection of functions and macros to help you benchmark and profile your code. Two of these are:
(defun count-repetitions (fn delay)
"Funcalls `fn` repeatedly for `delay` seconds. Returns
the number of times `fn` was called. Warning: the code
assumes that `fn` will not be called more than a fixnum
number of times."
...)
and
(defmacro while-counting-repetitions ((&optional (delay 1.0)) &body body)
"Execute `body` repeatedly for `delay` seconds. Returns
the number of times `body` is executed per second.
Warning: assumes that `body` will not be executed more
than a fixnum number of times. The `delay` defaults to
1.0."
...)
The main difference between the two variants — well, aside from one being a macro and one a function — is that count-repetitions must funcall your function whereas while-counting-repetitions includes your code in-line.
Let’s use them to look at three different solutions for the perennial “I want to turn a string into a keyword” problem. I’m also going to require that all of the strings be lowercased (just because). One solution uses read-from-string
(defun form-keyword-1 (name)
(read-from-string (format nil "~(:~A~) " name)))
another uses intern. We’ll look at two variants: the first looks up the keyword package each time; the second does it just once:
(defun form-keyword-2a (name)
(intern (string-downcase name) (find-package '#:keyword)))
(defun form-keyword-2b (name)
(intern (string-downcase name)
(load-time-value (find-package '#:keyword))))
Lastly, let’s see if there is any cost to calling intern unnecessarily by adding a variant that first uses find-symbol and only calls intern if it must.
(defun form-keyword-3 (name)
(let ((downcased-name (string-downcase name))
(keyword-package (load-time-value (find-package '#:keyword))))
(or (find-symbol downcased-name keyword-package)
(intern downcased-name keyword-package))))
Here’s what it looks like to try a simple test. We’ll use 5-seconds as our delay.
cl-user> (lift:count-repetitions
(lambda ()
(form-keyword-1 "hello")
(form-keyword-1 "butter"))
5.0)
57214.8
So form-keyword-1 (the read-from-string variant) can run about 57,000-times a second (this is under ACL in EMACS under Slime). The other three variants give counts of:
ACL SBCL
1: 57,215 37,354
2a: 689,888 329,896
2b: 986,085 447,137
3: 1,028,928 461,868
(Note: I’m using a somewhat out of date SBCL so these numbers shouldn’t be used to compare these two Lisps).
That’s a pretty huge difference on both of these Lisps. Allegro especially benefits from the load-time-value resolution of the keyword package and both Lisps should a slight improvement when calling find-symbol first (which actually surprised me. I would have thought that intern would have handled that logic already.)
Now lets see if funcalling is doing anything to change the results by switching over to the while-counting-repetitions macro:
cl-user> (lift:while-counting-repetitions (5)
(form-keyword-1 "hello")
(form-keyword-1 "butter"))
57633.6
Here’s the table
ACL SBCL
1: 57,634 37,960
2a: 686,941 328,316
2b: 992,373 451,186
3: 1,050,546 448,714
In this example, at least, the macro and the function appear to have no advantages one over the other.
CL-Containers and dynamic-classes have both been updated:
CL-Containers (0.10.2) sees a patch for insert-new-item from Daniel Dickison (thanks!) and some minor tweaks and one new test case.
dynamic-classes (1.0.1) sees an actual (though sadly empty) test-system. It feels much better not being saddled with one cut and pasted from LIFT.
Enjoy!
Job 1
Lisp Developer at Algorithmic Trading Software Vendor
We are looking for a Full Time Lisp developer with very strong math skills that also has experience with developing trading strategies and doing quant research in Lisp. Your work would consist of:
Coding functions that will be included in the system library and provided to customers (currently we have 500 functions completed covering everything from technical analysis to every major machine learning routine)
Coding complex machine learning routines to be included in the system library, with a focus on exposing every possible parameter and intermediate data series to the user, e.g., writing linear regression so that the coefficients, residuals, etc. are accessible data series and so that the least squares metric can be replaced with other variants by simply slotting in the new function name into the keyword based call.
Using profiling tools to assist with identifying functions that can be optimized for faster processing.
Working with an in-house product specialist and the CTO as well as quants at customer firms to develop functions in Lisp for customers on-demand (about 50% of your time), as well as assisting with strategy development (if you also have those skills).
Documenting Lisp functions
FFI work to C/C++, R and compiled MatLab functions
Assisting with extensions to the core Lisp engine (new preloaded functions, etc.)
We are the emerging leader in the space and have an enterprise class platform for building arbitrarily complex algorithmic trading strategies in a completely codeless drag-and-drop environment (strategies look like flow diagrams). The system's main server component is written in Lisp with an in-memory database. We have a heavy focus on machine learning functions that can be embedded into the strategies. The system is used for real-time high frequency trading, and backtests with enormous datasets and very computationally expensive routines.
Experience that would be a major plus, but is not necessarily required:
Advanced degree in quantitative discipline, e.g., Financial Engineering, Physics, Math, Statistics, Comp Sci, etc.
Have worked at hedge fund or prop trading firm or bank developing trading strategies
Experience developing machine learning algorithms such as neural nets, genetic algos, decision trees, Bayesian nets, hidden Markov models, particle swarm optimization, genetic programming, clustering, regressions, etc.
MatLab, C/C++ and R development experience
Working with threaded Lisps and real time systems, large datasets etc.
This position is for the Stamford, CT office, though if you are near the Petaluma, CA office and unable to relocate we would consider this as well. Please feel free to contact us even if we neglected to contact you after you responded to previous job postings. Please contact Rosario Ingargiola, CTO at Alphacet via rosarioi@alphacet.com .
Job 2
Product Specialist w/ Basic Lisp Dev Skills at Algorithmic Trading Software Vendor
The Product Specialist will become an expert user of our enterprise class application for the drag-and-drop based codeless strategy development, analysis and deployment application, and assist sales executives with product demonstrations and presentations, and handle client implementations and provide ongoing training and support. The Product Specialist will be will be instrumental in managing customer relationships during the implementation process and continued licensing usage.
Pre-sales: Assist sales team with product demonstrations and presentations. Provide training and implementation support to customers. Be able to understand and explain the Lisp code for any of the more than 500 functions in a growing library and help with improving documentation for those functions based upon customer questions/comments.
Post-sales: Assist with proprietary historical data upload and import of shared libraries that have been interfaced to Lisp. Help clients to expand proprietary strategy libraries by writing strategy logic and basic functions in Lisp. Work with other senior Lisp developers on development team to help define and then test more complex functions or strategies. Provide production support to customers via phone, e-mail or on-site. Assist customer in optimizing business processes around Alphacet Discovery. Interact with development team (issue reporting, new feature requests).
Use experience supporting customers to improve product documentation and training methods.
Major pluses, though not required:
Degree in quantitative discipline
Trading firm experience
Greater than basic Lisp development capabilities
Other development/IT and sales engineer experience
About Alphacet: The Company Alphacet, Inc. develops innovative software and solutions for quantitative analysts, traders and portfolio managers. The company’s flagship product is Alphacet Discovery, the only completely integrated solution for complex quantitative strategy development and deployment in the marketplace today. Alphacet Discovery seamlessly connects to leading market data vendors and market database partners, and provides advanced code-less financial modeling tools that allow ‘on the fly’ programming, back testing and walking forward of strategies - all through a revolutionary drag & drop interface. The company was founded in 2007, building on development that began in 2003, based on pioneering work by researchers at
the University of California. Alphacet is headquartered in Stamford, Connecticut, with development facilities in Petaluma, California.
This position is for the Stamford, CT office only. Please contact Rosario Ingargiola, CTO at Alphacet via rosarioi@alphacet.com .

Ok, Common Lisp is a small piece of a large development setup. But I couldn't resist linking to a developer interview with Austin Haas of Pet Tomato, since it includes this exchange:
In the alpha discussion, it was often suggested that you should have a UI gauge to show your fart "fuel." Can you elaborate on why you chose not to implement this?
Simplicity. I'm still not sure about it, though. Lately, I've considered the idea of having him fade-in/out and sweat a little to indicate when you are really tapped and shouldn't try to fart so soon.
Check out the development setup listed at the end for the Common Lisp connection.