trackler 2.0.6.21 → 2.0.6.22
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/common/exercises/prime-factors/canonical-data.json +42 -0
- data/lib/trackler/version.rb +1 -1
- data/tracks/elixir/exercises/beer-song/beer_song_test.exs +9 -9
- data/tracks/elixir/exercises/beer-song/example.exs +5 -5
- data/tracks/erlang/exercises/sum-of-multiples/sum_of_multiples_tests.erl +1 -1
- data/tracks/java/exercises/rectangles/src/example/java/RectangleCounter.java +30 -22
- data/tracks/julia/README.md +1 -0
- data/tracks/julia/config.json +10 -0
- data/tracks/julia/exercises/rna-transcription/example.jl +10 -0
- data/tracks/julia/exercises/rna-transcription/rna-transcription.jl +4 -0
- data/tracks/julia/exercises/rna-transcription/runtests.jl +40 -0
- data/tracks/pascal/docs/INSTALLATION.md +3 -3
- data/tracks/pascal/docs/img/00delphiwelcomepage.png +0 -0
- data/tracks/pascal/docs/img/00delphiwelcomepageLogo.png +0 -0
- data/tracks/pascal/docs/img/03delphioptionsenvironmentvariablesLogo.png +0 -0
- data/tracks/pascal/docs/img/06delphioptionslibraryLogo.png +0 -0
- data/tracks/scala/config.json +4 -0
- data/tracks/scala/exercises/alphametics/build.sbt +3 -4
- metadata +9 -3
- data/tracks/pascal/docs/img/10delphioptonsclickok.png +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4c345469ef70e6d1cbdbb6629050afdbcba27689
|
4
|
+
data.tar.gz: 9ed54ec084197a08ff4bda1d1bdf6b4564870250
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b6bc4c64ea54985dac6440d9d36d65d8c33023ec2542412cb1a3fdd25ff3c83aa69d49bdc9ee15ec239ca08cd8efa6b7af9dd08270959c772744ee4cd0bba5d9
|
7
|
+
data.tar.gz: 2200f840688526466ff8de0f90e81638d9409f6c261a008fb1245da36d81f672b344bd117e76c94ee9e8ce8f09eed41ad5650926c73463899346c5035fc0134f
|
@@ -0,0 +1,42 @@
|
|
1
|
+
{
|
2
|
+
"for": {
|
3
|
+
"description": "returns prime factors for the given input number",
|
4
|
+
"cases": [
|
5
|
+
{
|
6
|
+
"description" : "no factors",
|
7
|
+
"input" : 1,
|
8
|
+
"expected" : []
|
9
|
+
},
|
10
|
+
{
|
11
|
+
"description" : "prime number",
|
12
|
+
"input" : 2,
|
13
|
+
"expected" : [2]
|
14
|
+
},
|
15
|
+
{
|
16
|
+
"description" : "square of a prime",
|
17
|
+
"input" : 9,
|
18
|
+
"expected" : [3, 3]
|
19
|
+
},
|
20
|
+
{
|
21
|
+
"description" : "cube of a prime",
|
22
|
+
"input" : 8,
|
23
|
+
"expected" : [2, 2, 2]
|
24
|
+
},
|
25
|
+
{
|
26
|
+
"description" : "product of primes and non-primes",
|
27
|
+
"input" : 12,
|
28
|
+
"expected" : [2, 2, 3]
|
29
|
+
},
|
30
|
+
{
|
31
|
+
"description" : "product of primes",
|
32
|
+
"input" : 901255,
|
33
|
+
"expected" : [5, 17, 23, 461]
|
34
|
+
},
|
35
|
+
{
|
36
|
+
"description" : "factors include a large prime",
|
37
|
+
"input" : 93819012551,
|
38
|
+
"expected" : [11, 9539, 894119]
|
39
|
+
}
|
40
|
+
]
|
41
|
+
}
|
42
|
+
}
|
data/lib/trackler/version.rb
CHANGED
@@ -8,32 +8,32 @@ ExUnit.configure exclude: :pending, trace: true
|
|
8
8
|
defmodule BeerSongTest do
|
9
9
|
use ExUnit.Case
|
10
10
|
|
11
|
-
test "getting
|
12
|
-
assert BeerSong.verse(
|
11
|
+
test "getting the first verse (99 bottles)" do
|
12
|
+
assert BeerSong.verse(99) == """
|
13
13
|
99 bottles of beer on the wall, 99 bottles of beer.
|
14
14
|
Take one down and pass it around, 98 bottles of beer on the wall.
|
15
15
|
"""
|
16
16
|
end
|
17
17
|
|
18
18
|
@tag :pending
|
19
|
-
test "getting
|
20
|
-
assert BeerSong.verse(
|
19
|
+
test "getting the second verse (98 bottles)" do
|
20
|
+
assert BeerSong.verse(98) == """
|
21
21
|
98 bottles of beer on the wall, 98 bottles of beer.
|
22
22
|
Take one down and pass it around, 97 bottles of beer on the wall.
|
23
23
|
"""
|
24
24
|
end
|
25
25
|
|
26
26
|
@tag :pending
|
27
|
-
test "getting just the
|
28
|
-
assert BeerSong.verse(
|
27
|
+
test "getting just the penultimate verse" do
|
28
|
+
assert BeerSong.verse(1) == """
|
29
29
|
1 bottle of beer on the wall, 1 bottle of beer.
|
30
30
|
Take it down and pass it around, no more bottles of beer on the wall.
|
31
31
|
"""
|
32
32
|
end
|
33
33
|
|
34
34
|
@tag :pending
|
35
|
-
test "getting just the
|
36
|
-
assert BeerSong.verse(
|
35
|
+
test "getting just the last verse" do
|
36
|
+
assert BeerSong.verse(0) == """
|
37
37
|
No more bottles of beer on the wall, no more bottles of beer.
|
38
38
|
Go to the store and buy some more, 99 bottles of beer on the wall.
|
39
39
|
"""
|
@@ -41,7 +41,7 @@ defmodule BeerSongTest do
|
|
41
41
|
|
42
42
|
@tag :pending
|
43
43
|
test "getting the last 4 verses" do
|
44
|
-
assert BeerSong.lyrics(
|
44
|
+
assert BeerSong.lyrics(3..0) == """
|
45
45
|
3 bottles of beer on the wall, 3 bottles of beer.
|
46
46
|
Take one down and pass it around, 2 bottles of beer on the wall.
|
47
47
|
|
@@ -1,21 +1,21 @@
|
|
1
1
|
defmodule BeerSong do
|
2
|
-
def verse(
|
2
|
+
def verse(0) do
|
3
3
|
"No more bottles of beer on the wall, no more bottles of beer.\nGo to the store and buy some more, 99 bottles of beer on the wall.\n"
|
4
4
|
end
|
5
5
|
|
6
|
-
def verse(
|
6
|
+
def verse(1) do
|
7
7
|
"1 bottle of beer on the wall, 1 bottle of beer.\nTake it down and pass it around, no more bottles of beer on the wall.\n"
|
8
8
|
end
|
9
9
|
|
10
|
-
def verse(
|
10
|
+
def verse(2) do
|
11
11
|
"2 bottles of beer on the wall, 2 bottles of beer.\nTake one down and pass it around, 1 bottle of beer on the wall.\n"
|
12
12
|
end
|
13
13
|
|
14
14
|
def verse(number) do
|
15
|
-
"#{number
|
15
|
+
"#{number} bottles of beer on the wall, #{number} bottles of beer.\nTake one down and pass it around, #{number - 1} bottles of beer on the wall.\n"
|
16
16
|
end
|
17
17
|
|
18
|
-
def lyrics(range \\
|
18
|
+
def lyrics(range \\ 99..0) do
|
19
19
|
range
|
20
20
|
|> Enum.map(&verse/1)
|
21
21
|
|> Enum.join("\n")
|
@@ -15,34 +15,42 @@ final class RectangleCounter {
|
|
15
15
|
|
16
16
|
private static final class Grid {
|
17
17
|
|
18
|
-
private enum
|
18
|
+
private enum Tile {
|
19
19
|
CORNER,
|
20
|
-
|
21
|
-
|
20
|
+
HORIZONTAL_WALL,
|
21
|
+
VERTICAL_WALL,
|
22
22
|
SPACE;
|
23
23
|
|
24
|
-
private static
|
25
|
-
switch (
|
24
|
+
private static Tile fromChar(final char rawGridTile) {
|
25
|
+
switch (rawGridTile) {
|
26
26
|
case '+': return CORNER;
|
27
|
-
case '-': return
|
28
|
-
case '|': return
|
27
|
+
case '-': return HORIZONTAL_WALL;
|
28
|
+
case '|': return VERTICAL_WALL;
|
29
29
|
case ' ': return SPACE;
|
30
|
-
default: throw new IllegalStateException("Grid
|
30
|
+
default: throw new IllegalStateException("Grid tile " + rawGridTile + " not recognized.");
|
31
31
|
}
|
32
32
|
}
|
33
|
+
|
34
|
+
private boolean isHorizontalConnector() {
|
35
|
+
return this == CORNER || this == HORIZONTAL_WALL;
|
36
|
+
}
|
37
|
+
|
38
|
+
private boolean isVerticalConnector() {
|
39
|
+
return this == CORNER || this == VERTICAL_WALL;
|
40
|
+
}
|
33
41
|
}
|
34
42
|
|
35
43
|
private int nRows, nCols;
|
36
|
-
private final
|
44
|
+
private final Tile[][] tiles;
|
37
45
|
|
38
46
|
private Grid(final int nRows, final int nCols, final String[] rawGrid) {
|
39
47
|
this.nRows = nRows;
|
40
48
|
this.nCols = nCols;
|
41
|
-
this.
|
49
|
+
this.tiles = new Tile[nRows][nCols];
|
42
50
|
|
43
51
|
for (int nRow = 0; nRow < nRows; nRow++) {
|
44
52
|
for (int nCol = 0; nCol < nCols; nCol++) {
|
45
|
-
|
53
|
+
tiles[nRow][nCol] = Tile.fromChar(rawGrid[nRow].charAt(nCol));
|
46
54
|
}
|
47
55
|
}
|
48
56
|
}
|
@@ -76,10 +84,10 @@ final class RectangleCounter {
|
|
76
84
|
final int leftCol,
|
77
85
|
final int rightCol) {
|
78
86
|
|
79
|
-
return
|
80
|
-
&&
|
81
|
-
&&
|
82
|
-
&&
|
87
|
+
return tiles[topRow][leftCol].equals(Tile.CORNER)
|
88
|
+
&& tiles[topRow][rightCol].equals(Tile.CORNER)
|
89
|
+
&& tiles[bottomRow][leftCol].equals(Tile.CORNER)
|
90
|
+
&& tiles[bottomRow][rightCol].equals(Tile.CORNER)
|
83
91
|
&& isHorizontalLineSegment(topRow, leftCol, rightCol)
|
84
92
|
&& isHorizontalLineSegment(bottomRow, leftCol, rightCol)
|
85
93
|
&& isVerticalLineSegment(leftCol, topRow, bottomRow)
|
@@ -88,23 +96,23 @@ final class RectangleCounter {
|
|
88
96
|
|
89
97
|
private boolean isHorizontalLineSegment(final int row, final int leftCol, final int rightCol) {
|
90
98
|
return stream(copyOfRange(getRow(row), leftCol, rightCol))
|
91
|
-
.allMatch(
|
99
|
+
.allMatch(Tile::isHorizontalConnector);
|
92
100
|
}
|
93
101
|
|
94
102
|
private boolean isVerticalLineSegment(final int col, final int topRow, final int bottomRow) {
|
95
103
|
return stream(copyOfRange(getCol(col), topRow, bottomRow))
|
96
|
-
.allMatch(
|
104
|
+
.allMatch(Tile::isVerticalConnector);
|
97
105
|
}
|
98
106
|
|
99
|
-
private
|
100
|
-
return
|
107
|
+
private Tile[] getRow(final int number) {
|
108
|
+
return tiles[number];
|
101
109
|
}
|
102
110
|
|
103
|
-
private
|
104
|
-
final
|
111
|
+
private Tile[] getCol(final int number) {
|
112
|
+
final Tile[] result = new Tile[nRows];
|
105
113
|
|
106
114
|
for (int nRow = 0; nRow < nRows; nRow++) {
|
107
|
-
result[nRow] =
|
115
|
+
result[nRow] = tiles[nRow][number];
|
108
116
|
}
|
109
117
|
|
110
118
|
return result;
|
data/tracks/julia/README.md
CHANGED
data/tracks/julia/config.json
CHANGED
@@ -5,6 +5,16 @@
|
|
5
5
|
"active": false,
|
6
6
|
"test_pattern": "TODO",
|
7
7
|
"exercises": [
|
8
|
+
{
|
9
|
+
"slug": "rna-transcription",
|
10
|
+
"difficulty": 1,
|
11
|
+
"topics": [
|
12
|
+
"exception handling",
|
13
|
+
"strings",
|
14
|
+
"pattern matching",
|
15
|
+
"filtering"
|
16
|
+
]
|
17
|
+
},
|
8
18
|
{
|
9
19
|
"slug": "leap",
|
10
20
|
"difficulty": 1,
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# Given a DNA strand, its transcribed RNA strand is formed by replacing each nucleotide with its complement:
|
2
|
+
# G -> C, C -> G, T -> A, A -> U
|
3
|
+
function to_rna(dna::AbstractString)
|
4
|
+
typeof(match(r"^[GCTA]+$", dna)) == Void && error("Invalid RNA strand")
|
5
|
+
# Define character associations
|
6
|
+
a_nucleotides = Dict('G'=>'C', 'C'=>'G', 'T'=>'A', 'A'=>'U')
|
7
|
+
# Replace characters using dictionary
|
8
|
+
map((x)->a_nucleotides[x], dna)
|
9
|
+
end
|
10
|
+
|
@@ -0,0 +1,40 @@
|
|
1
|
+
using Base.Test
|
2
|
+
|
3
|
+
include("rna-transcription.jl")
|
4
|
+
|
5
|
+
@testset "basic transformations" begin
|
6
|
+
@testset "rna complement of cytosine is guanine" begin
|
7
|
+
@test to_rna("C") == "G"
|
8
|
+
end
|
9
|
+
|
10
|
+
@testset "rna complement of guanine is cytosine" begin
|
11
|
+
@test to_rna("G") == "C"
|
12
|
+
end
|
13
|
+
|
14
|
+
@testset "rna complement of thymine is adenine" begin
|
15
|
+
@test to_rna("T") == "A"
|
16
|
+
end
|
17
|
+
|
18
|
+
@testset "rna complement of adenine is uracil" begin
|
19
|
+
@test to_rna("A") == "U"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
@testset "rna complement" begin
|
24
|
+
@test to_rna("ACGTGGTCTTAA") == "UGCACCAGAAUU"
|
25
|
+
end
|
26
|
+
|
27
|
+
@testset "error handling" begin
|
28
|
+
@testset "dna correctly handles invalid input" begin
|
29
|
+
@test_throws ErrorException to_rna("U")
|
30
|
+
end
|
31
|
+
|
32
|
+
@testset "dna correctly handles completely invalid input" begin
|
33
|
+
@test_throws ErrorException to_rna("XXX")
|
34
|
+
end
|
35
|
+
|
36
|
+
@testset "dna correctly handles partially invalid input" begin
|
37
|
+
@test_throws ErrorException to_rna("ACGTXXXCTTAA")
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
@@ -25,7 +25,7 @@ If you had to install DUnitX because your installation didn't already come with
|
|
25
25
|
|
26
26
|
- Start Delphi. If your installation is new you will most likely end up at a Welcome Page similar to this.
|
27
27
|
|
28
|
-
![Welcome Page](http://x.exercism.io/v3/tracks/pascal/docs/img/00delphiwelcomepage.png)
|
28
|
+
[![Welcome Page](http://x.exercism.io/v3/tracks/pascal/docs/img/00delphiwelcomepageLogo.png)](http://x.exercism.io/v3/tracks/pascal/docs/img/00delphiwelcomepage.png)
|
29
29
|
|
30
30
|
- Find and click `Tools` along the top menu.
|
31
31
|
|
@@ -37,7 +37,7 @@ If you had to install DUnitX because your installation didn't already come with
|
|
37
37
|
|
38
38
|
- Along the left side of the Options screen find and click on `Environment Variables`.
|
39
39
|
|
40
|
-
![Options Screen Environment Variables](http://x.exercism.io/v3/tracks/pascal/docs/img/03delphioptionsenvironmentvariables.png)
|
40
|
+
[![Options Screen Environment Variables](http://x.exercism.io/v3/tracks/pascal/docs/img/03delphioptionsenvironmentvariablesLogo.png)](http://x.exercism.io/v3/tracks/pascal/docs/img/03delphioptionsenvironmentvariables.png)
|
41
41
|
|
42
42
|
- Click the `New` button located in the `User overrides` group
|
43
43
|
|
@@ -49,7 +49,7 @@ If you had to install DUnitX because your installation didn't already come with
|
|
49
49
|
|
50
50
|
- Locate and click on `Library` along the left side of the Options screen.
|
51
51
|
|
52
|
-
![Library](http://x.exercism.io/v3/tracks/pascal/docs/img/06delphioptionslibrary.png)
|
52
|
+
![[Library](http://x.exercism.io/v3/tracks/pascal/docs/img/06delphioptionslibraryLogo.png)](http://x.exercism.io/v3/tracks/pascal/docs/img/06delphioptionslibrary.png)
|
53
53
|
|
54
54
|
- Click the `...` button associated with the Library path in the Directories group
|
55
55
|
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/tracks/scala/config.json
CHANGED
@@ -1,6 +1,5 @@
|
|
1
|
-
scalaVersion := "2.
|
1
|
+
scalaVersion := "2.12.1"
|
2
2
|
|
3
|
-
libraryDependencies += "org.scalatest"
|
4
|
-
|
5
|
-
libraryDependencies += "org.scala-lang.modules" %% "scala-parser-combinators" % "1.0.4"
|
3
|
+
libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.1" % "test"
|
4
|
+
libraryDependencies += "org.scala-lang.modules" %% "scala-parser-combinators" % "1.0.5"
|
6
5
|
|
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.0.6.
|
4
|
+
version: 2.0.6.22
|
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-01-
|
11
|
+
date: 2017-01-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubyzip
|
@@ -301,6 +301,7 @@ files:
|
|
301
301
|
- common/exercises/pov/canonical-data.json
|
302
302
|
- common/exercises/pov/description.md
|
303
303
|
- common/exercises/pov/metadata.yml
|
304
|
+
- common/exercises/prime-factors/canonical-data.json
|
304
305
|
- common/exercises/prime-factors/description.md
|
305
306
|
- common/exercises/prime-factors/metadata.yml
|
306
307
|
- common/exercises/protein-translation/description.md
|
@@ -4030,6 +4031,9 @@ files:
|
|
4030
4031
|
- tracks/julia/exercises/leap/example.jl
|
4031
4032
|
- tracks/julia/exercises/leap/leap.jl
|
4032
4033
|
- tracks/julia/exercises/leap/runtests.jl
|
4034
|
+
- tracks/julia/exercises/rna-transcription/example.jl
|
4035
|
+
- tracks/julia/exercises/rna-transcription/rna-transcription.jl
|
4036
|
+
- tracks/julia/exercises/rna-transcription/runtests.jl
|
4033
4037
|
- tracks/julia/img/.keep
|
4034
4038
|
- tracks/julia/runtests.jl
|
4035
4039
|
- tracks/kotlin/.git
|
@@ -5190,16 +5194,18 @@ files:
|
|
5190
5194
|
- tracks/pascal/docs/RESOURCES.md
|
5191
5195
|
- tracks/pascal/docs/TESTS.md
|
5192
5196
|
- tracks/pascal/docs/img/00delphiwelcomepage.png
|
5197
|
+
- tracks/pascal/docs/img/00delphiwelcomepageLogo.png
|
5193
5198
|
- tracks/pascal/docs/img/01delphiclicktools.png
|
5194
5199
|
- tracks/pascal/docs/img/02delphiclickoptions.png
|
5195
5200
|
- tracks/pascal/docs/img/03delphioptionsenvironmentvariables.png
|
5201
|
+
- tracks/pascal/docs/img/03delphioptionsenvironmentvariablesLogo.png
|
5196
5202
|
- tracks/pascal/docs/img/04delphioptionsenvironmentvariablesclicknew.png
|
5197
5203
|
- tracks/pascal/docs/img/05delphinewuservariable.png
|
5198
5204
|
- tracks/pascal/docs/img/06delphioptionslibrary.png
|
5205
|
+
- tracks/pascal/docs/img/06delphioptionslibraryLogo.png
|
5199
5206
|
- tracks/pascal/docs/img/07delphiclicklibrarypathbutton.png
|
5200
5207
|
- tracks/pascal/docs/img/08delphidirectoriesinputvarnameclickadd.png
|
5201
5208
|
- tracks/pascal/docs/img/09delphidirectoriesclickok.png
|
5202
|
-
- tracks/pascal/docs/img/10delphioptonsclickok.png
|
5203
5209
|
- tracks/pascal/exercises/.keep
|
5204
5210
|
- tracks/pascal/exercises/allergies/AllergyTests.dpr
|
5205
5211
|
- tracks/pascal/exercises/allergies/uAllergiesExample.pas
|
Binary file
|