guide to scala, promises and higher order functions