Sha256: aa0c6545a88063db7b509f4162bd8b3b7620cfb4972cc9186503744d8868cdad

Contents?: true

Size: 346 Bytes

Versions: 230

Compression:

Stored size: 346 Bytes

Contents

package letter

func ConcurrentFrequency(l []string) FreqMap {
	switch len(l) {
	case 0:
		return FreqMap{}
	case 1:
		return Frequency(l[0])
	}
	ch := make(chan FreqMap)
	f := func(l []string) {
		ch <- ConcurrentFrequency(l)
	}
	half := len(l) / 2
	go f(l[:half])
	go f(l[half:])
	m := <-ch
	for r, n := range <-ch {
		m[r] += n
	}
	return m
}

Version data entries

230 entries across 230 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/go/exercises/parallel-letter-frequency/example.go
trackler-2.2.1.179 tracks/go/exercises/parallel-letter-frequency/example.go
trackler-2.2.1.178 tracks/go/exercises/parallel-letter-frequency/example.go
trackler-2.2.1.177 tracks/go/exercises/parallel-letter-frequency/example.go
trackler-2.2.1.176 tracks/go/exercises/parallel-letter-frequency/example.go
trackler-2.2.1.175 tracks/go/exercises/parallel-letter-frequency/example.go
trackler-2.2.1.174 tracks/go/exercises/parallel-letter-frequency/example.go
trackler-2.2.1.173 tracks/go/exercises/parallel-letter-frequency/example.go
trackler-2.2.1.172 tracks/go/exercises/parallel-letter-frequency/example.go
trackler-2.2.1.171 tracks/go/exercises/parallel-letter-frequency/example.go
trackler-2.2.1.170 tracks/go/exercises/parallel-letter-frequency/example.go
trackler-2.2.1.169 tracks/go/exercises/parallel-letter-frequency/example.go
trackler-2.2.1.167 tracks/go/exercises/parallel-letter-frequency/example.go
trackler-2.2.1.166 tracks/go/exercises/parallel-letter-frequency/example.go
trackler-2.2.1.165 tracks/go/exercises/parallel-letter-frequency/example.go
trackler-2.2.1.164 tracks/go/exercises/parallel-letter-frequency/example.go
trackler-2.2.1.163 tracks/go/exercises/parallel-letter-frequency/example.go
trackler-2.2.1.162 tracks/go/exercises/parallel-letter-frequency/example.go
trackler-2.2.1.161 tracks/go/exercises/parallel-letter-frequency/example.go
trackler-2.2.1.160 tracks/go/exercises/parallel-letter-frequency/example.go