Skip to content

Instantly share code, notes, and snippets.

View WorldDownTown's full-sized avatar
🍺
working with beers

Keisuke Shoji WorldDownTown

🍺
working with beers
  • Tokyo, Japan
View GitHub Profile
@WorldDownTown
WorldDownTown / map_filter_reduce.swift
Created January 24, 2016 06:29 — forked from Nirma/map_filter_reduce.swift
Map and filter implemented with a version of reduce taking list as its reduce argument.
func reduce<T,R>(list: [T], block: (([R],T) -> R?)) -> [R]? {
var acc = [R]()
for x in list {
if let val = block(acc, x) {
acc += [val]
}
}
return acc
}
@WorldDownTown
WorldDownTown / Decorators.go
Created March 24, 2016 02:18 — forked from Nirma/Decorators.go
Using Decorators in Golang to profile performance
package main
import (
"fmt"
"math/rand"
"sort"
"time"
)