Author Archives: Josh Smith

About Josh Smith

Josh Smith is a musician at heart, and a software developer by obsession. He lives in Arizona, plays classical music on the piano, jazz on the guitar, and enjoys brutally long rides on his bicycle. He has a wonderful wife & son and thinks that, in general, life is good.

Compressing a Swift array

Suppose you have an array of values in your Swift app and you need to compress it to a smaller size, with the intention of making it occupy less memory. If the array contains many consecutive repeated values it could be … Continue reading

Posted in Swift | Tagged | 1 Comment

I’m back

This blog’s half year of inactivity is over. I had joined Apple as a software engineer, to work on a low-level communications component that runs on all iOS and OS X devices. As an Apple employee I was prohibited from blogging, hence … Continue reading

Posted in Uncategorized | 6 Comments

Creating ASCII art in functional Swift

This article explores an iOS app, written in a functional Swift style, that converts an image to ASCII art. For example, when given the famous Lenna photograph… …it creates a string that, when printed, looks something like this… Zooming into … Continue reading

Posted in Swift | Tagged , | 5 Comments

Zipping two lists in Haskell

Studying a pure functional programming, such as Haskell, can be an eye-opening experience. The standard library in Haskell provides a zip function, which combines the elements of two lists into a single list of tuples. I decided to implement my own version, named zip … Continue reading

Posted in Uncategorized | Tagged ,

Caesar cipher in Swift

I posted a Swift project to GitHub that implements the Caesar cipher, which was the encryption technique used to protect Julius Caesar’s personal correspondence. It’s a straightforward algorithm that maps each letter in the alphabet to another letter. The code also … Continue reading

Posted in Swift | Tagged , | 2 Comments

Functional parallel programming in Elixir

This article reviews a program that implements a parallelized algorithm, using a functional programming style made possible by a fantastic new language named Elixir. Along the way I very briefly introduce Elixir, review the relevance of functional programming in modern … Continue reading

Posted in Uncategorized

Getting into functional programming with Swift

This article examines two implementations of a logic puzzle written in Swift. The first example uses an imperative programming style, which is the style familiar to most iOS developers. Then we see the same small program written in a functional style, which is … Continue reading

Posted in Swift | Tagged , | 12 Comments