Describir: Implementing algebraic dynamic programming in the functional and the imperative programming paradigm