Michael Weber: Random Bits and Pieces

A from-scratch version of the Bottle Song in Lisp: bottle-song.lisp. We can see some nice features of FORMAT in action (conditionals, relative & absolute go-to, user extensions, pluralization, radix control, case conversion, etc.), but by far not everything that is offered.

;; * clisp bottle-song.lisp

(in-package :cl-user)

(defun bottle-song (&optional (in-stock 99) (stream *standard-output*))
  ;; Original idea by Geoff Summerhayes <sumrnot@hotmail.com>
  ;; Formatting idea by Fred Gilham <gilham@snapdragon.csl.sri.com>
  ;; Actual formatting & minor recoding by Kent M Pitman
  ;;   <pitman@world.std.com>
  ;; Redone for conformance to <http://www.99-bottles-of-beer.net/>
  ;;   by Michael Weber <michaelw@foldr.org>.

           ~:/bottles/ ~
         of beer on ~000%~
         the wall, ~001:*~
         ~99/bottles/ of ~
         beer.~1:*~%~[Go ~
         to the store and~
         ~000@* buy some ~
         more, ~/bottles/~
         ~00% of beer on ~
         the wall.~01%~:;~
         Take one down an~
         d pass it around~
         , ~999/bottles/ ~
         ~:*of beer on th~
         e wall.~002%~]~}"
           (1+ in-stock)

   (loop for bottle from in-stock downto 0 collect bottle)))

(defun bottles (stream arg &optional colonp atp &rest args)
  (declare (ignore atp args))
  (format stream "~[~:[n~;N~]o more bottles~:;~:*~A bottle~:*~P~]"
          arg colonp))


Alternatively, numbers can be printed as (properly capitalized) words with:

(defun bottles (stream arg &optional colonp atp &rest args)
  (declare (ignore atp args))
  (format stream "~[~:[n~;N~]o more bottles~:;~
                  ~:[~2:*~R~;~2:*~@(~R~)~] bottle~:*~P~]"
          arg colonp))

Ninety-nine bottles of beer on the wall, ninety-nine bottles of beer.
Take one down and pass it around, ninety-eight bottles of beer on the wall.

Ninety-eight bottles of beer on the wall, ninety-eight bottles of beer.
Take one down and pass it around, ninety-seven bottles of beer on the wall.


UPDATE 2009-04-08: Fame, at last!

Zach Beane showed the bottle song sources (in form of a Format Automotivator) during his ILC2009 lightning talk about the Wigflig imperium!

Format Automotivator Poster (by Zach Beane)
New Paper

A Database Approach to Distributed State Space Generation.


We study distributed state-space generation on a cluster of workstations. It is explained why state-space partitioning by a global hash function is problematic when states contain variables from unbounded domains, such as lists or other recursive data types. Our solution is to introduce a database which maintains a global numbering of state values. We also describe tree compression, a technique of recursive state folding, and show that it is superior to manipulating plain state vectors. This solution is implemented and linked to the µCRL toolset, where state values are implemented as maximally shared terms (ATerms). However, it is applicable to other models as well, e.g. PROMELA or LOTOS models. Our experiments show the trade-offs between keeping the database global, replicated or local, depending on the available network bandwidth and latency.

This paper is a journal version of an earlier article. We explain tree compression in more detail and added more measurements.

A Dirty Job

2009-01-25 :: /events

It was a dirty job, but it had to be done… Today, I scraped probably half a kilogram of mud off my bicycle, mostly accumulated during the winter months. It was about a year ago that I bought the bike, and I made around 2300 km with it so far. Nothing to write home about, I think I can do better this year.

A couple of things still need to be done:

  • Chain, guides and sprockets suffered quite a bit. I'd have to take them apart to clean them thoroughly. Which is not so much fun when having to do it outside with near-freezing temperatures. Perhaps the employer-sponsored bike inspection will cover it.
    In any case, they work much better again.
  • Rims of front and rear wheels need to be swapped.
  • The rear disc brake works, but not that well anymore. I hope it was just due to the wetness after the cleaning, and not oil or anything. In the latter case, I'd be in for a new rotor and pads… In any case, I am mostly using the front brake anyway, which is snappy as ever.

In other news, I installed the new clipless SPD pedals today and made a test ride. I am still a little clumsy clipping into them, but getting out again worked suprisingly well. I wonder how it will be when I have to get out of them unexpectedly (which is not unlikely considering the usual road rage around here). I adjusted the clips to be really loose, and I guess I'll keep it like that until I got used to them. The downside is that it makes them a little wobbly to the sides when riding. Perhaps I should buy a helmet…

Then again, my commute to work is not nearly as interesting as the one from these guys:

Video of NYC Bicycle Messengers

Wired Magazine has an article about how the Dutch plan to save their country from rising sea levels.

View Larger Map

More than ten years ago, the systems of the Maeslant Storm Surge Barrier in the Nieuwe Waterweg were checked to meet their specification (note my careful wording) by researchers from the group I am working in (Formal Methods and Tools, University of Twente):

It would probably be a worthwhile exercise to repeat the checks today to see whether the procedure has gotten any easier, thereby assessing whether the perceived improvements in Formal Methods over the last decade are actually real.

My prediction would be that still the collaboration of experts of both fields is very much needed. Perhaps more precise results can be obtained, perhaps in shorter time. Perhaps as of today unknown security problems could be found…

Lisp Logo (by Conrad Barsky)

Rainer Joswig has an awesome library of Lisp books!

Page 5/29: « 1 2 3 4 5 6 7 8 9 »