Skip to content

Instantly share code, notes, and snippets.

View NorrinRadd's full-sized avatar

Brandon Trussell NorrinRadd

View GitHub Profile
struct IterateVars<T> {
let f: T -> T
func go(inout x: T) -> IterateVars {
x = f(x)
return self
}
}
var a = 2.0;
enum Endianness {
case Big
case Little
func swapWithNative(slice: Slice<UInt8>) -> Slice<UInt8> {
#if true
let native = Little
#else
let native = Big
#endif
func forAllCombinations<T>(r1 : Range<T>, r2 : Range<T>, body : (T, T) -> ()) {
for i in r1 {
for j in r2 {
body(i, j)
}
}
}
forAllCombinations(0..3, 0..5) {
(i, j) in