# A newbie's proud first code

**Lennart Augustsson
**
lennart@augustsson.net

*Mon, 05 Nov 2001 05:12:14 -0500*

Luke Maurer wrote:
>* My only issue (and it is nitpicky) is that I don't really like having to
*>* declare an extra function (euler') in the same scope as euler. I tried
*>* playing with where clauses or let expressions, but I couldn't find a way to
*>* make GHC happy without introducing a bunch of extra variables (since I'd
*>* need new versions of the arguments to euler; in euler', I just used the same
*>* names. Also, nested "where" doesn't work as I'd like it to.) Is there, in
*>* fact, a more concise way to express what I'm doing?
*
How about?
euler :: (Num a) => (a -> a -> a) -> a -> a -> [a]
euler f' dt f0 = euler' f0 0
where euler' f t = f : euler' fnext (t + dt)
where fnext = f + dt * (f' f t)
-- Lennart