Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- func activeEmails(emails es)(emails){
- length := len(es)
- switch length{
- case 0:
- return nil
- case 1:
- return emails.Active ? emails:nil
- default:
- fchan := make(chan emails, 2)
- f := func (emails slice){
- output := []
- for i : range slice {
- if (slice[i].Active){
- output = append(output, slice[i])
- }
- }
- fchan <- output
- }
- half := length/2
- go f(es[0:half])
- go f(es[half:length])
- f1 <- fchan
- f2 <- fchan
- close(fchan)
- return append(f1, f2...)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement