Skip to content

Instantly share code, notes, and snippets.

@richo
Created April 8, 2015 04:24
Show Gist options
  • Select an option

  • Save richo/01d6e6d35a7b9d837a87 to your computer and use it in GitHub Desktop.

Select an option

Save richo/01d6e6d35a7b9d837a87 to your computer and use it in GitHub Desktop.
package main
func <T>Map(c chan *T) []T {
var out []*T
range t := c {
if out == nil {
break
}
out = append(out, t)
}
return out
}
func IntMap = Map<int>
func FloatMap = Map<float64>
func MapSomeInts(c chan int) []int {
return IntMap(c)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment