
Swift nuggets in 140 Extended Grapheme Cluster Literals or fewer.
Joined November 2014
- Tweets26
- Following72
- Followers205
- Likes37
☛ Tweetable Swift Challenge #3: grouping strings! More information here: 140swift.tumblr.com/post/105…
Thanks for playing! (2/2) @CodaFi_ @_lanceparker @theslinker @ColinEberhardt @DeFrenZ @ChromophoreApp
2
Awards and a downloadable playground! 140swift.tumblr.com/post/104… #SwiftLang
☞ The 2nd weekly Tweetable Swift challenge starts… now! Prime Factorization - rules and more info: 140swift.tumblr.com/post/104… #SwiftLang #Swift
Tweetable Swift retweeted
Swift's acceptance of unicode identifiers sure is fun: mikeash.com/tmp/screenshot_C…
Forgot mine! 😳
reduce(s, (true, "")) {
(!$0.0, $0.0 ?
"\($0.1)\($1)" :
"\(dropLast($0.1))\($1)\(last($0.1)!)"
)
}.1
#SwiftLang
2
Trophies for everyone! 140swift.tumblr.com/post/104… #SwiftLang
☞ Announcing the 1st weekly Tweetable Swift challenge! String Twiddling - rules and more info: 140swift.tumblr.com/post/104… #SwiftLang #Swift
join("\r",map(Array(1...n), { i -> String in
if i%3==0 { return i%5==0 ? "FizzBuzz" : "Fizz" }
else { return i%5==0 ? "Buzz" : "\(i)" }
}))
Tweetable Swift retweeted
extension Array {
func nonnilmap<X>(transform:(T->X?))->[X] { return (transform).filter{ $0 != nil }.map { $0! as X } }
} #swift
let luhn=0==reduce(reverse(map(💳){"\($0)".toInt()!}),[(false,0)]){$0+[(!$0.last!.0,$0.last!.0 ? $1*2/10+$1*2%10:$1)]}.reduce(0){$0+$1.1}%10
1
1
func reduceRight<T, U>(s: [T], i: U, c: (U, T) -> U) -> U {
return reduce(lazy(s).reverse(), i) { c($0, $1) }
}
#Swift #SwiftLang

