Swift Functions as Types

For the well-versed functional programmer, the fact that functions in Swift are Types is no surprise. But I’m relatively new to the game on that front, so when I first encountered the idea of thinking of a function as a Type back when Swift was announced in 2014, it was a real eye-opener for me. […]

Conveniently Transforming Immutable Types in Swift

A few weeks ago I wrote about Immutable Types and Changing State in Swift, where I hoped to convey an “aha!-moment” that happened for me. Since then, I’ve learned a bit more. For example, the technique I presented for transforming instances of a Type immutably actually come for free when you use a value Type, […]

Immutable Types with Changing State in Swift

Dabble in Swift for long and the functional programming paradigm will most certainly appear on your radar. From conferences to books to blog posts, I’ve seen a lot in the functional programming arena as it relates to Swift. As I seek to improve my functional programming thought processes and to practice what I’m learning, I […]

Resolving “Variable used within its own initial value” Error in Swift

While experimenting with a few things today, I experienced this compiler error: Variable used within its own initial value Let me describe the situation I was in… I was playing (in a playground, no less) with closures, trying to mimic some behavior that I’ve recently learned about in Scala.  Essentially, I was trying to implement a factorial […]