Kalman algorithm with a functional style.