Overview of the basics of Functional Programming using the Swift programming language. Presented at the Functional Programming Miniconf at Linux.conf.au 2016, in Geelong.
https://swift.org/download/#linux; extract it $ tar xzf swift-<VERSION>-<PLATFORM>.tar.gz $ export PATH=/path/to/usr/bin:"${PATH}" This creates a usr/ directory; add it to your path: Swift is now installed! Download the pre-requisites:
Type :help for assistance. 1> let text = "Don t worry if you are not computer" text: String = "Don t worry if you are not computer" 2> text.uppercaseString $R0: String = "DON T WORRY IF YOU ARE NOT COMPUTER" 3>
in a functional style provides benefits. You should do it whenever it is convenient, and you should think hard about the decision when it isn't convenient.”
_ funcB: T->T) -> T->T { // Return a new function that calls them both return { funcB(funcA($0)) } } // Two dumb lil functions let double = { $0 * 2 } let addOne = { $0 + 1 }
_ funcB: T->T) -> T->T { // Return a new function that calls them both return { funcB(funcA($0)) } } // Two dumb lil functions let double = { $0 * 2 } let addOne = { $0 + 1 } // Compose 'em! let doubleAndAddOne = compose(double, addOne)
_ funcB: T->T) -> T->T { // Return a new function that calls them both return { funcB(funcA($0)) } } // Two dumb lil functions let double = { $0 * 2 } let addOne = { $0 + 1 } // Compose 'em! let doubleAndAddOne = compose(double, addOne) doubleAndAddOne(5)
• Pearls of Functional Algorithm Design • Programming in Haskell (Hutton) • Apple’s Swift Book(s) • IBM Swift Resources: https://developer.ibm.com/swift/