Simple factorial function written in swift