Reading and Writing IP Addresses in common lisp with help from #lisp

Last week I had been refactoring some code related to IP Addresses in our internal software at In our old code, I came across a pretty speedy ip-address printer that was faster than a naive approach by a good margin. A few days latter Stas Boukarev (stassats) happened to be discussing optimizing this function in #lisp. I sent him our slightly optimized version and after pasting back and forth, by the end of the day he had a very rapid function.

I added a pretty speedy IP address parser and the result of this work is cl-cidr-notation ( This provides fast portable functions for reading ip-addresses and cidr blocks from strings into ints and for writing those ints back into dotted-quad notation (, and cidr blocks into their standard notation ( It can also efficiently print range strings (

Leave a Reply

Your email address will not be published. Required fields are marked *