This may be subjective, I don\'t know: I have this problem, which I\'m kind of equating to the \"what language for this project?\" question, since I can\'t seem to solve it.
Use psuedo-code to explain your algorithms. That would be more generic than using a general-purpose programming language with library API.
How complex do you feel your DSL will have to be? Will it take a lot for readers to become familiar with it?
Although you would get to fill the back of your book with the source code to the library to fill those pages.
I would choose a DSL over a general purpose language.