1. -- one step of integration
  2. stepEuler :: (Floating a) => a -> [a] -> [a]
  3. stepEuler mu u@(x:xs) = (applyBC . (diffused mu)) $! u -- strict evaluation of u
  4.     where
  5.           diffused mu (left:x:[]) = []    -- ignore outer points
  6.           diffused mu (left:x:right:xs) = -- integrate inner points
  7.                    (x+mu*(left+right-2*x)) : diffused mu (x:right:xs)
  8.           applyBC inner = inner `seq` u' `seq` l  `seq` r `seq` -- strict evaluation
  9.                          (l ++ inner ++ r) -- boundary conditions
  10.               where u' = [head u] ++ inner ++ [last u]
  11.                      l = lbc u'
  12.                     r = rbc u'
  13.                      lbc = zeroflux mu             -- left boundary
  14.                      rbc = (zeroflux mu) . reverse -- right boundary
  15.