Skip to content

Instantly share code, notes, and snippets.

@khoi
khoi / curry.swift
Last active November 9, 2017 15:58
emoji oriented programming
//Emojify https://github.com/thoughtbot/Curry/blob/master/Source/Curry.swift
import Foundation
public func ๐Ÿ›<๐Ÿถ, ๐Ÿ˜บ>(_ function: @escaping (๐Ÿถ) -> ๐Ÿ˜บ) -> (๐Ÿถ) -> ๐Ÿ˜บ {
return { (a: ๐Ÿถ) -> ๐Ÿ˜บ in function(a) }
}
public func ๐Ÿ›<๐Ÿถ, ๐Ÿ˜บ, ๐Ÿญ>(_ function: @escaping (๐Ÿถ, ๐Ÿ˜บ) -> ๐Ÿญ) -> (๐Ÿถ) -> (๐Ÿ˜บ) -> ๐Ÿญ {
return { (a: ๐Ÿถ) -> (๐Ÿ˜บ) -> ๐Ÿญ in { (b: ๐Ÿ˜บ) -> ๐Ÿญ in function(a, b) } }
}