trackler 2.2.1.66 → 2.2.1.67

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. checksums.yaml +4 -4
  2. data/lib/trackler/version.rb +1 -1
  3. data/problem-specifications/README.md +1 -0
  4. data/tracks/bash/exercises/anagram/anagram_tests.sh +16 -0
  5. data/tracks/bash/exercises/bob/bob_test.sh +28 -0
  6. data/tracks/bash/exercises/difference-of-squares/difference_of_squares_test.sh +3 -0
  7. data/tracks/bash/exercises/error-handling/error_handling_test.sh +5 -0
  8. data/tracks/bash/exercises/gigasecond/gigasecond_test.sh +10 -0
  9. data/tracks/bash/exercises/hamming/hamming_test.sh +15 -0
  10. data/tracks/bash/exercises/leap/leap_test.sh +10 -0
  11. data/tracks/bash/exercises/nucleotide-count/nucleotide_count_test.sh +4 -0
  12. data/tracks/bash/exercises/pangram/pangram_tests.sh +9 -0
  13. data/tracks/bash/exercises/phone-number/phone_number_tests.sh +13 -1
  14. data/tracks/bash/exercises/raindrops/raindrops_test.sh +16 -0
  15. data/tracks/bash/exercises/rna-transcription/rna_transcription_test.sh +8 -0
  16. data/tracks/bash/exercises/two-fer/two_fer_test.sh +3 -0
  17. data/tracks/bash/exercises/word-count/word_count_test.sh +9 -1
  18. data/tracks/c/exercises/hello-world/src/hello_world.c +0 -2
  19. data/tracks/c/exercises/sieve/test/test_sieve.c +13 -16
  20. data/tracks/erlang/config.json +4 -4
  21. data/tracks/fsharp/config.json +12 -0
  22. data/tracks/fsharp/exercises/Exercises.sln +6 -0
  23. data/tracks/fsharp/exercises/rotational-cipher/Example.fs +29 -0
  24. data/tracks/fsharp/exercises/rotational-cipher/Program.fs +1 -0
  25. data/tracks/fsharp/exercises/rotational-cipher/README.md +29 -0
  26. data/tracks/fsharp/exercises/rotational-cipher/RotationalCipher.fs +3 -0
  27. data/tracks/fsharp/exercises/rotational-cipher/RotationalCipher.fsproj +23 -0
  28. data/tracks/fsharp/exercises/rotational-cipher/RotationalCipherTest.fs +49 -0
  29. data/tracks/fsharp/generators/Generators.fs +3 -0
  30. data/tracks/go/exercises/grains/.meta/gen.go +99 -0
  31. data/tracks/go/exercises/grains/cases_test.go +64 -0
  32. data/tracks/go/exercises/grains/grains_test.go +4 -20
  33. data/tracks/go/exercises/space-age/space_age_test.go +3 -1
  34. data/tracks/java/config.json +12 -0
  35. data/tracks/java/exercises/beer-song/.meta/src/reference/java/BeerSong.java +4 -4
  36. data/tracks/java/exercises/diamond/src/main/java/DiamondPrinter.java +9 -0
  37. data/tracks/java/exercises/isbn-verifier/.meta/src/reference/java/IsbnVerifier.java +35 -0
  38. data/tracks/java/exercises/isbn-verifier/.meta/version +1 -0
  39. data/tracks/java/exercises/isbn-verifier/README.md +53 -0
  40. data/tracks/java/exercises/isbn-verifier/build.gradle +18 -0
  41. data/tracks/java/exercises/isbn-verifier/src/main/java/IsbnVerifier.java +7 -0
  42. data/tracks/java/exercises/isbn-verifier/src/test/java/IsbnVerifierTest.java +94 -0
  43. data/tracks/java/exercises/isogram/src/main/java/IsogramChecker.java +7 -0
  44. data/tracks/java/exercises/saddle-points/src/main/java/Matrix.java +13 -0
  45. data/tracks/java/exercises/settings.gradle +1 -0
  46. data/tracks/kotlin/config.json +1 -1
  47. data/tracks/ocaml/exercises/all-your-base/example.ml +1 -1
  48. data/tracks/ocaml/exercises/all-your-base/test.ml +9 -9
  49. data/tracks/perl6/config.json +1 -1
  50. data/tracks/perl6/docs/SNIPPET.txt +2 -2
  51. data/tracks/perl6/exercises/anagram/Anagram.pm6 +4 -1
  52. data/tracks/perl6/exercises/anagram/Example.pm6 +4 -15
  53. data/tracks/perl6/exercises/anagram/anagram.t +2 -2
  54. data/tracks/perl6/exercises/anagram/example.yaml +7 -15
  55. data/tracks/php/config.json +12 -0
  56. data/tracks/php/exercises/run-length-encoding/README.md +42 -0
  57. data/tracks/php/exercises/run-length-encoding/example.php +60 -0
  58. data/tracks/php/exercises/run-length-encoding/run-length-encoding.php +20 -0
  59. data/tracks/php/exercises/run-length-encoding/run-length-encoding_test.php +65 -0
  60. data/tracks/purescript/.travis.yml +1 -1
  61. data/tracks/purescript/bin/test.sh +9 -2
  62. data/tracks/python/config.json +7 -16
  63. data/tracks/r/exercises/hello-world/test_hello-world.R +0 -8
  64. data/tracks/racket/config.json +1 -1
  65. data/tracks/swift/config.json +12 -2
  66. data/tracks/swift/exercises/diamond/Package.swift +5 -0
  67. data/tracks/swift/exercises/diamond/README.md +64 -0
  68. data/tracks/swift/exercises/diamond/Sources/Diamond.swift +1 -0
  69. data/tracks/swift/exercises/diamond/Sources/DiamondExample.swift +30 -0
  70. data/tracks/swift/exercises/diamond/Tests/DiamondTests/DiamondTests.swift +98 -0
  71. data/tracks/swift/exercises/diamond/Tests/LinuxMain.swift +6 -0
  72. metadata +29 -8
  73. data/tracks/java/exercises/diamond/src/main/java/.keep +0 -0
  74. data/tracks/java/exercises/isogram/src/main/java/.keep +0 -0
  75. data/tracks/python/exercises/parallel-letter-frequency/README.md +0 -24
  76. data/tracks/python/exercises/parallel-letter-frequency/example.py +0 -56
  77. data/tracks/python/exercises/parallel-letter-frequency/parallel_letter_frequency.py +0 -2
  78. data/tracks/python/exercises/parallel-letter-frequency/parallel_letter_frequency_test.py +0 -61
@@ -5,12 +5,4 @@ test_that("no name", {
5
5
  expect_equal(hello_world(), "Hello, World!")
6
6
  })
7
7
 
8
- test_that("sample name", {
9
- expect_equal(hello_world("Alice"), "Hello, Alice!")
10
- })
11
-
12
- test_that("other sample name", {
13
- expect_equal(hello_world("Bob"), "Hello, Bob!")
14
- })
15
-
16
8
  message("All tests passed for exercise: hello-world")
@@ -104,7 +104,7 @@
104
104
  "strings"
105
105
  ],
106
106
  "unlocked_by": null,
107
- "uuid": "d330a93f-063f-0d80-f35b-02cc2f9da754e0be296"
107
+ "uuid": "72ac5f36-ec1b-465e-b359-1cc49efc262d"
108
108
  },
109
109
  {
110
110
  "core": false,
@@ -346,7 +346,17 @@
346
346
  "mathematics"
347
347
  ],
348
348
  "unlocked_by": null,
349
- "uuid": "899bd49a-0970-9a80-5e6b-2adf5bfd0bf79f480ba"
349
+ "uuid": "1b068d66-c8de-42a8-a566-03848c9c7941"
350
+ },
351
+ {
352
+ "core": false,
353
+ "difficulty": 3,
354
+ "slug": "diamond",
355
+ "topics": [
356
+ "strings"
357
+ ],
358
+ "unlocked_by": null,
359
+ "uuid": "6d70fd81-76a4-4e44-a64a-9a070e07e83d"
350
360
  },
351
361
  {
352
362
  "core": false,
@@ -831,4 +841,4 @@
831
841
  ],
832
842
  "foregone": [],
833
843
  "language": "Swift"
834
- }
844
+ }
@@ -0,0 +1,5 @@
1
+ import PackageDescription
2
+
3
+ let package = Package(
4
+ name: "Diamond"
5
+ )
@@ -0,0 +1,64 @@
1
+ The diamond kata takes as its input a letter, and outputs it in a diamond
2
+ shape. Given a letter, it prints a diamond starting with 'A', with the
3
+ supplied letter at the widest point.
4
+
5
+ ## Requirements
6
+
7
+ * The first row contains one 'A'.
8
+ * The last row contains one 'A'.
9
+ * All rows, except the first and last, have exactly two identical letters.
10
+ * All rows have as many trailing spaces as leading spaces. (This might be 0).
11
+ * The diamond is horizontally symmetric.
12
+ * The diamond is vertically symmetric.
13
+ * The diamond has a square shape (width equals height).
14
+ * The letters form a diamond shape.
15
+ * The top half has the letters in ascending order.
16
+ * The bottom half has the letters in descending order.
17
+ * The four corners (containing the spaces) are triangles.
18
+
19
+ ## Examples
20
+
21
+ In the following examples, spaces are indicated by `·` characters.
22
+
23
+ Diamond for letter 'A':
24
+
25
+ ```text
26
+ A
27
+ ```
28
+
29
+ Diamond for letter 'C':
30
+
31
+ ```text
32
+ ··A··
33
+ ·B·B·
34
+ C···C
35
+ ·B·B·
36
+ ··A··
37
+ ```
38
+
39
+ Diamond for letter 'E':
40
+
41
+ ```text
42
+ ····A····
43
+ ···B·B···
44
+ ··C···C··
45
+ ·D·····D·
46
+ E·······E
47
+ ·D·····D·
48
+ ··C···C··
49
+ ···B·B···
50
+ ····A····
51
+ ```
52
+
53
+ ## Setup
54
+
55
+ Go through the project setup instructions for Xcode using Swift:
56
+
57
+ http://exercism.io/languages/swift
58
+
59
+ ## Source
60
+
61
+ Seb Rose [http://claysnow.co.uk/recycling-tests-in-tdd/](http://claysnow.co.uk/recycling-tests-in-tdd/)
62
+
63
+ ## Submitting Incomplete Solutions
64
+ It's possible to submit an incomplete solution so you can see how others have completed the exercise.
@@ -0,0 +1 @@
1
+ //Solution goes in Sources
@@ -0,0 +1,30 @@
1
+ struct Diamond {
2
+ static let alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".characters.map { $0 }
3
+
4
+ static func makeDiamond(letter: Character) -> [String] {
5
+ guard let index = alphabet.index(of: letter) else {
6
+ return []
7
+ }
8
+
9
+ let numberOfLines = index * 2 + 1
10
+ let middle = numberOfLines / 2
11
+ var result = [String]()
12
+
13
+ for lineNumber in 0..<numberOfLines {
14
+ var line = ""
15
+
16
+ for column in 0..<numberOfLines {
17
+ let distanceFromMiddle = middle - abs(middle - lineNumber)
18
+
19
+ if abs(middle - column) == distanceFromMiddle {
20
+ line.append(alphabet[distanceFromMiddle])
21
+ } else {
22
+ line.append(" ")
23
+ }
24
+ }
25
+ result.append(line)
26
+ }
27
+
28
+ return result
29
+ }
30
+ }
@@ -0,0 +1,98 @@
1
+ import XCTest
2
+ @testable import Diamond
3
+
4
+ class DiamondTests: XCTestCase {
5
+
6
+ func testLetterA() {
7
+ XCTAssertEqual(Diamond.makeDiamond(letter: "A"), ["A"])
8
+ }
9
+
10
+ func testLetterC() {
11
+ let expected = [
12
+ " A ",
13
+ " B B ",
14
+ "C C",
15
+ " B B ",
16
+ " A "]
17
+ XCTAssertEqual(Diamond.makeDiamond(letter: "C"), expected)
18
+ }
19
+
20
+ func testLetterE() {
21
+ let expected = [
22
+ " A ",
23
+ " B B ",
24
+ " C C ",
25
+ " D D ",
26
+ "E E",
27
+ " D D ",
28
+ " C C ",
29
+ " B B ",
30
+ " A "]
31
+ XCTAssertEqual(Diamond.makeDiamond(letter: "E"), expected)
32
+ }
33
+
34
+ func testLargestPossibleDiamond() {
35
+ let expected = [
36
+ " A ",
37
+ " B B ",
38
+ " C C ",
39
+ " D D ",
40
+ " E E ",
41
+ " F F ",
42
+ " G G ",
43
+ " H H ",
44
+ " I I ",
45
+ " J J ",
46
+ " K K ",
47
+ " L L ",
48
+ " M M ",
49
+ " N N ",
50
+ " O O ",
51
+ " P P ",
52
+ " Q Q ",
53
+ " R R ",
54
+ " S S ",
55
+ " T T ",
56
+ " U U ",
57
+ " V V ",
58
+ " W W ",
59
+ " X X ",
60
+ " Y Y ",
61
+ "Z Z",
62
+ " Y Y ",
63
+ " X X ",
64
+ " W W ",
65
+ " V V ",
66
+ " U U ",
67
+ " T T ",
68
+ " S S ",
69
+ " R R ",
70
+ " Q Q ",
71
+ " P P ",
72
+ " O O ",
73
+ " N N ",
74
+ " M M ",
75
+ " L L ",
76
+ " K K ",
77
+ " J J ",
78
+ " I I ",
79
+ " H H ",
80
+ " G G ",
81
+ " F F ",
82
+ " E E ",
83
+ " D D ",
84
+ " C C ",
85
+ " B B ",
86
+ " A "]
87
+ XCTAssertEqual(Diamond.makeDiamond(letter: "Z"), expected)
88
+ }
89
+
90
+ static var allTests: [(String, (DiamondTests) -> () throws -> Void)] {
91
+ return [
92
+ ("testLetterA", testLetterA),
93
+ ("testLetterC", testLetterC),
94
+ ("testLetterE", testLetterE),
95
+ ("testLargestPossibleDiamond", testLargestPossibleDiamond),
96
+ ]
97
+ }
98
+ }
@@ -0,0 +1,6 @@
1
+ import XCTest
2
+ @testable import DiamondTests
3
+
4
+ XCTMain([
5
+ testCase(DiamondTests.allTests),
6
+ ])
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trackler
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.1.66
4
+ version: 2.2.1.67
5
5
  platform: ruby
6
6
  authors:
7
7
  - Katrina Owen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-15 00:00:00.000000000 Z
11
+ date: 2017-11-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubyzip
@@ -5388,6 +5388,12 @@ files:
5388
5388
  - tracks/fsharp/exercises/roman-numerals/RomanNumerals.fs
5389
5389
  - tracks/fsharp/exercises/roman-numerals/RomanNumerals.fsproj
5390
5390
  - tracks/fsharp/exercises/roman-numerals/RomanNumeralsTest.fs
5391
+ - tracks/fsharp/exercises/rotational-cipher/Example.fs
5392
+ - tracks/fsharp/exercises/rotational-cipher/Program.fs
5393
+ - tracks/fsharp/exercises/rotational-cipher/README.md
5394
+ - tracks/fsharp/exercises/rotational-cipher/RotationalCipher.fs
5395
+ - tracks/fsharp/exercises/rotational-cipher/RotationalCipher.fsproj
5396
+ - tracks/fsharp/exercises/rotational-cipher/RotationalCipherTest.fs
5391
5397
  - tracks/fsharp/exercises/run-length-encoding/Example.fs
5392
5398
  - tracks/fsharp/exercises/run-length-encoding/Program.fs
5393
5399
  - tracks/fsharp/exercises/run-length-encoding/README.md
@@ -5785,7 +5791,9 @@ files:
5785
5791
  - tracks/go/exercises/grade-school/README.md
5786
5792
  - tracks/go/exercises/grade-school/example.go
5787
5793
  - tracks/go/exercises/grade-school/grade_school_test.go
5794
+ - tracks/go/exercises/grains/.meta/gen.go
5788
5795
  - tracks/go/exercises/grains/README.md
5796
+ - tracks/go/exercises/grains/cases_test.go
5789
5797
  - tracks/go/exercises/grains/example.go
5790
5798
  - tracks/go/exercises/grains/grains_test.go
5791
5799
  - tracks/go/exercises/hamming/.meta/gen.go
@@ -7100,7 +7108,7 @@ files:
7100
7108
  - tracks/java/exercises/diamond/.meta/version
7101
7109
  - tracks/java/exercises/diamond/README.md
7102
7110
  - tracks/java/exercises/diamond/build.gradle
7103
- - tracks/java/exercises/diamond/src/main/java/.keep
7111
+ - tracks/java/exercises/diamond/src/main/java/DiamondPrinter.java
7104
7112
  - tracks/java/exercises/diamond/src/test/java/DiamondPrinterTest.java
7105
7113
  - tracks/java/exercises/difference-of-squares/.meta/src/reference/java/DifferenceOfSquaresCalculator.java
7106
7114
  - tracks/java/exercises/difference-of-squares/.meta/version
@@ -7166,11 +7174,17 @@ files:
7166
7174
  - tracks/java/exercises/house/build.gradle
7167
7175
  - tracks/java/exercises/house/src/main/java/.keep
7168
7176
  - tracks/java/exercises/house/src/test/java/HouseTest.java
7177
+ - tracks/java/exercises/isbn-verifier/.meta/src/reference/java/IsbnVerifier.java
7178
+ - tracks/java/exercises/isbn-verifier/.meta/version
7179
+ - tracks/java/exercises/isbn-verifier/README.md
7180
+ - tracks/java/exercises/isbn-verifier/build.gradle
7181
+ - tracks/java/exercises/isbn-verifier/src/main/java/IsbnVerifier.java
7182
+ - tracks/java/exercises/isbn-verifier/src/test/java/IsbnVerifierTest.java
7169
7183
  - tracks/java/exercises/isogram/.meta/hints.md
7170
7184
  - tracks/java/exercises/isogram/.meta/src/reference/java/IsogramChecker.java
7171
7185
  - tracks/java/exercises/isogram/README.md
7172
7186
  - tracks/java/exercises/isogram/build.gradle
7173
- - tracks/java/exercises/isogram/src/main/java/.keep
7187
+ - tracks/java/exercises/isogram/src/main/java/IsogramChecker.java
7174
7188
  - tracks/java/exercises/isogram/src/test/java/IsogramCheckerTest.java
7175
7189
  - tracks/java/exercises/kindergarten-garden/.meta/src/reference/java/KindergartenGarden.java
7176
7190
  - tracks/java/exercises/kindergarten-garden/.meta/src/reference/java/Plant.java
@@ -7356,6 +7370,7 @@ files:
7356
7370
  - tracks/java/exercises/saddle-points/.meta/version
7357
7371
  - tracks/java/exercises/saddle-points/README.md
7358
7372
  - tracks/java/exercises/saddle-points/build.gradle
7373
+ - tracks/java/exercises/saddle-points/src/main/java/Matrix.java
7359
7374
  - tracks/java/exercises/saddle-points/src/main/java/MatrixCoordinate.java
7360
7375
  - tracks/java/exercises/saddle-points/src/test/java/MatrixTest.java
7361
7376
  - tracks/java/exercises/scrabble-score/.meta/src/reference/java/Scrabble.java
@@ -10133,6 +10148,10 @@ files:
10133
10148
  - tracks/php/exercises/roman-numerals/README.md
10134
10149
  - tracks/php/exercises/roman-numerals/example.php
10135
10150
  - tracks/php/exercises/roman-numerals/roman-numerals_test.php
10151
+ - tracks/php/exercises/run-length-encoding/README.md
10152
+ - tracks/php/exercises/run-length-encoding/example.php
10153
+ - tracks/php/exercises/run-length-encoding/run-length-encoding.php
10154
+ - tracks/php/exercises/run-length-encoding/run-length-encoding_test.php
10136
10155
  - tracks/php/exercises/scrabble-score/README.md
10137
10156
  - tracks/php/exercises/scrabble-score/example.php
10138
10157
  - tracks/php/exercises/scrabble-score/scrabble-score_test.php
@@ -10766,10 +10785,6 @@ files:
10766
10785
  - tracks/python/exercises/pangram/example.py
10767
10786
  - tracks/python/exercises/pangram/pangram.py
10768
10787
  - tracks/python/exercises/pangram/pangram_test.py
10769
- - tracks/python/exercises/parallel-letter-frequency/README.md
10770
- - tracks/python/exercises/parallel-letter-frequency/example.py
10771
- - tracks/python/exercises/parallel-letter-frequency/parallel_letter_frequency.py
10772
- - tracks/python/exercises/parallel-letter-frequency/parallel_letter_frequency_test.py
10773
10788
  - tracks/python/exercises/pascals-triangle/README.md
10774
10789
  - tracks/python/exercises/pascals-triangle/example.py
10775
10790
  - tracks/python/exercises/pascals-triangle/pascals_triangle.py
@@ -13190,6 +13205,12 @@ files:
13190
13205
  - tracks/swift/exercises/custom-set/Sources/CustomSetExample.swift
13191
13206
  - tracks/swift/exercises/custom-set/Tests/CustomSetTests/CustomSetTests.swift
13192
13207
  - tracks/swift/exercises/custom-set/Tests/LinuxMain.swift
13208
+ - tracks/swift/exercises/diamond/Package.swift
13209
+ - tracks/swift/exercises/diamond/README.md
13210
+ - tracks/swift/exercises/diamond/Sources/Diamond.swift
13211
+ - tracks/swift/exercises/diamond/Sources/DiamondExample.swift
13212
+ - tracks/swift/exercises/diamond/Tests/DiamondTests/DiamondTests.swift
13213
+ - tracks/swift/exercises/diamond/Tests/LinuxMain.swift
13193
13214
  - tracks/swift/exercises/difference-of-squares/.gitignore
13194
13215
  - tracks/swift/exercises/difference-of-squares/Package.swift
13195
13216
  - tracks/swift/exercises/difference-of-squares/README.md
@@ -1,24 +0,0 @@
1
- # Parallel Letter Frequency
2
-
3
- Count the frequency of letters in texts using parallel computation.
4
-
5
- Parallelism is about doing things in parallel that can also be done
6
- sequentially. A common example is counting the frequency of letters.
7
- Create a function that returns the total frequency of each letter in a
8
- list of texts and that employs parallelism.
9
-
10
- The letters used consists of ASCII letters `a` to `z`, inclusive, and is case
11
- insensitive.
12
-
13
- ## Submitting Exercises
14
-
15
- Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/<exerciseName>` directory.
16
-
17
- For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/python/bob/bob.py`.
18
-
19
-
20
- For more detailed information about running tests, code style and linting,
21
- please see the [help page](http://exercism.io/languages/python).
22
-
23
- ## Submitting Incomplete Solutions
24
- It's possible to submit an incomplete solution so you can see how others have completed the exercise.
@@ -1,56 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- from collections import Counter
3
- from threading import Lock, Thread
4
- from time import sleep
5
- import sys
6
- if sys.version[0] == '2':
7
- from Queue import Queue
8
- else:
9
- from queue import Queue
10
-
11
- total_workers = 3 # Maximum number of threads chosen arbitrarily
12
-
13
-
14
- class LetterCounter(object):
15
-
16
- def __init__(self):
17
- self.lock = Lock()
18
- self.value = Counter()
19
-
20
- def add_counter(self, counter_to_add):
21
- self.lock.acquire()
22
- try:
23
- self.value = self.value + counter_to_add
24
- finally:
25
- self.lock.release()
26
-
27
-
28
- def count_letters(queue_of_texts, letter_to_frequency, worker_id):
29
- while not queue_of_texts.empty():
30
- sleep(worker_id + 1)
31
- line_input = queue_of_texts.get()
32
- if line_input is not None:
33
- letters_in_line = Counter([x for x in line_input.lower() if
34
- x.isalpha()])
35
- letter_to_frequency.add_counter(letters_in_line)
36
- queue_of_texts.task_done()
37
- if line_input is None:
38
- break
39
-
40
-
41
- def calculate(list_of_texts):
42
- queue_of_texts = Queue()
43
- [queue_of_texts.put(line) for line in list_of_texts]
44
- letter_to_frequency = LetterCounter()
45
- threads = []
46
- for i in range(total_workers):
47
- worker = Thread(target=count_letters, args=(queue_of_texts,
48
- letter_to_frequency, i))
49
- worker.start()
50
- threads.append(worker)
51
- queue_of_texts.join()
52
- for i in range(total_workers):
53
- queue_of_texts.put(None)
54
- for t in threads:
55
- t.join()
56
- return letter_to_frequency.value