Lilypond also has a guile API, and if you are not interested in the actual notation generation or at least how it looks, it can make some pretty weird and cool midi files. You can turn it into a kind of makeshift lisp Supercollider pattern generator.