A newbie's proud first code

Koen Claessen koen@cs.chalmers.se
Mon, 5 Nov 2001 14:09:41 +0100 (MET)

Jerzy suggested:

  eulerJ f' dt f0 = map snd (iterate (\(t,f)->(t+dt,f+dt*f' t f)) (0,f0) )

This is nice. Some people prefer list comprehensions over
the use of `map' and `iterate':

  eulerK f' dt f0 = fs
      fs = f0 : [ f+dt*f' t f | (t,f) <- [0,dt..] `zip` fs ]

(Jerzy, you can write this on one line if you want :-)