completed implementation of scanl with our without foldr