Pure function practice, from Haskell youtube video, which talks about Javascript, implement with Swift