Created
April 8, 2015 04:24
-
-
Save richo/01d6e6d35a7b9d837a87 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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