Let me instead advocate auto differentiaton. It enables writing mathematical expressions as normal programs, is less error prone for the programmer, is well defined at every valid point in the derivative, and is better at using sharing when computing higher order derivatives. An excellent library for this is, called ad, is available in Haskell.
edit: link to package is http://hackage.haskell.org/package/ad/
edit2: I should also add that MOST auto differentiation libraries also have a problem of not being able to distinguish the differential/ epsilon used in two independent derivative calculations, and this can lead to subtle / large numerical errors.
The AD library uses some haskell type system cleverness to prevent users from making that mistake!
a nice exposition of this problem can be found in this excellent blog post http://conway.rutgers.edu/~ccshan/wiki/blog/posts/Differenti...
btw, I've been to some of the recent LispNYC events, have you been to recent ones?
Take Haskell type, formally find its derivative, notice this new type is useful for traversing the original one and (optionally) explode your head.
(They call it zipper)