Emoji code.

/Emoji code.

Swift, Apple’s multi-purpose programming language for its various platforms, apparently supports full Unicode.

The actual intent of this is to assist programmers whose native languages use non-Roman character sets. The practical result is that it means you can type code that looks like:

infix operator ⛏ {}
public func ⛏(set: Set, count: Int) -> Set {
    func rnd(i: Int) -> Int {return Int(arc4random_uniform(UInt32(i)))}
    var items = set, chosenItems: Set = []
    (1...count).forEach { _ in
        let whichOne = items
            .startIndex.advancedBy(rnd(items.count))
        chosenItems
            .insert(items.removeAtIndex(whichOne))
    }
    return chosenItems
}

Set(["a", "b", "c", "d", "e"]) ⛏ 3 // pick 3 members
2018-04-27T13:58:50+00:002nd April, 2016|Tags: programming|3 Comments
3 ♥  codek-tv  i-am-programming  kaiocoffeelove

Comments are closed.