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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6de615318283e74b1a4ba367fe22c32fd9327479
4
- data.tar.gz: 51532eb3b0e3814f86ba58b6bd22fedfcaa2b274
3
+ metadata.gz: 4c345469ef70e6d1cbdbb6629050afdbcba27689
4
+ data.tar.gz: 9ed54ec084197a08ff4bda1d1bdf6b4564870250
5
5
  SHA512:
6
- metadata.gz: 5f3edb30c5879a9f5a3c4c5e225911c50cce4c7456448b28d49215439eef1e8d4146cd1da18bfec00a413a6d55bff6d7d9109df70b1d4d7850c837acd015fb97
7
- data.tar.gz: 23c1c02ee95b90b4bff31c628bbbd25066e23bcadc339bbaa9d25f4fda817e9e835230f6930a4296621d7ed31a0d9860cc15fc09e3951ca2a5497b16336047b4
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
+ }
@@ -1,3 +1,3 @@
1
1
  module Trackler
2
- VERSION = "2.0.6.21"
2
+ VERSION = "2.0.6.22"
3
3
  end
@@ -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 just the 100th verse" do
12
- assert BeerSong.verse(100) == """
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 just the 99th verse" do
20
- assert BeerSong.verse(99) == """
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 2nd verse" do
28
- assert BeerSong.verse(2) == """
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 1st verse" do
36
- assert BeerSong.verse(1) == """
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(4..1) == """
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(1) do
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(2) do
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(3) do
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 - 1} bottles of beer on the wall, #{number - 1} bottles of beer.\nTake one down and pass it around, #{number - 2} bottles of beer on the wall.\n"
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 \\ 100..1) do
18
+ def lyrics(range \\ 99..0) do
19
19
  range
20
20
  |> Enum.map(&verse/1)
21
21
  |> Enum.join("\n")
@@ -1,5 +1,5 @@
1
1
  -module(sum_of_multiples_tests).
2
- -import(sum_of_multiples, [sumOfMultiplesDefault/1, sumOfMultiples/2]).
2
+ -import(sum_of_multiples, [sumOfMultiples/2]).
3
3
 
4
4
  -include_lib("eunit/include/eunit.hrl").
5
5
 
@@ -15,34 +15,42 @@ final class RectangleCounter {
15
15
 
16
16
  private static final class Grid {
17
17
 
18
- private enum Entry {
18
+ private enum Tile {
19
19
  CORNER,
20
- HLINE,
21
- VLINE,
20
+ HORIZONTAL_WALL,
21
+ VERTICAL_WALL,
22
22
  SPACE;
23
23
 
24
- private static Entry fromChar(final char rawGridEntry) {
25
- switch (rawGridEntry) {
24
+ private static Tile fromChar(final char rawGridTile) {
25
+ switch (rawGridTile) {
26
26
  case '+': return CORNER;
27
- case '-': return HLINE;
28
- case '|': return VLINE;
27
+ case '-': return HORIZONTAL_WALL;
28
+ case '|': return VERTICAL_WALL;
29
29
  case ' ': return SPACE;
30
- default: throw new IllegalStateException("Grid entry " + rawGridEntry + " not recognized.");
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 Entry[][] entries;
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.entries = new Entry[nRows][nCols];
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
- entries[nRow][nCol] = Entry.fromChar(rawGrid[nRow].charAt(nCol));
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 entries[topRow][leftCol].equals(Entry.CORNER)
80
- && entries[topRow][rightCol].equals(Entry.CORNER)
81
- && entries[bottomRow][leftCol].equals(Entry.CORNER)
82
- && entries[bottomRow][rightCol].equals(Entry.CORNER)
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(entry -> entry.equals(Entry.HLINE) || entry.equals(Entry.CORNER));
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(entry -> entry.equals(Entry.VLINE) || entry.equals(Entry.CORNER));
104
+ .allMatch(Tile::isVerticalConnector);
97
105
  }
98
106
 
99
- private Entry[] getRow(final int number) {
100
- return entries[number];
107
+ private Tile[] getRow(final int number) {
108
+ return tiles[number];
101
109
  }
102
110
 
103
- private Entry[] getCol(final int number) {
104
- final Entry[] result = new Entry[nRows];
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] = entries[nRow][number];
115
+ result[nRow] = tiles[nRow][number];
108
116
  }
109
117
 
110
118
  return result;
@@ -1,4 +1,5 @@
1
1
  # Exercism Julia Track
2
+ [![Build Status](https://travis-ci.org/exercism/xjulia.svg?branch=master)](https://travis-ci.org/exercism/xjulia)
2
3
 
3
4
  Exercism exercises in Julia.
4
5
 
@@ -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,4 @@
1
+ function to_rna(dna::AbstractString)
2
+
3
+ end
4
+
@@ -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
 
@@ -496,6 +496,10 @@
496
496
  "slug": "alphametics",
497
497
  "difficulty": 1,
498
498
  "topics": [
499
+ "Maps",
500
+ "Optional values",
501
+ "Strings",
502
+ "Parsing"
499
503
  ]
500
504
  },
501
505
  {
@@ -1,6 +1,5 @@
1
- scalaVersion := "2.11.8"
1
+ scalaVersion := "2.12.1"
2
2
 
3
- libraryDependencies += "org.scalatest" % "scalatest_2.11" % "2.2.5" % "test"
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.21
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-26 00:00:00.000000000 Z
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