first attempts at modelling the circular buffer example in scala