trackler 2.2.1.129 → 2.2.1.130
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/trackler/version.rb +1 -1
- data/problem-specifications/exercises/scale-generator/description.md +9 -16
- data/tracks/dart/config.json +9 -9
- data/tracks/dart/exercises/raindrops/lib/raindrops.dart +1 -1
- data/tracks/dart/exercises/raindrops/test/raindrops_test.dart +59 -44
- data/tracks/dart/exercises/rna-transcription/test/rna_transcription_test.dart +37 -44
- data/tracks/fsharp/exercises/go-counting/Example.fs +24 -20
- data/tracks/fsharp/exercises/go-counting/GoCountingTest.fs +110 -51
- data/tracks/fsharp/generators/Generators.fs +84 -0
- data/tracks/java/config.json +13 -13
- data/tracks/purescript/config.json +12 -0
- data/tracks/purescript/exercises/phone-number/README.md +36 -0
- data/tracks/purescript/exercises/phone-number/bower.json +26 -0
- data/tracks/purescript/exercises/phone-number/examples/src/PhoneNumber.purs +30 -0
- data/tracks/purescript/exercises/phone-number/src/PhoneNumber.purs +6 -0
- data/tracks/purescript/exercises/phone-number/test/Main.purs +50 -0
- data/tracks/rust/_test/check-stubs.sh +29 -0
- data/tracks/rust/_test/ensure-stubs-compile.sh +24 -5
- data/tracks/rust/exercises/all-your-base/src/lib.rs +1 -2
- data/tracks/rust/exercises/armstrong-numbers/src/lib.rs +2 -2
- data/tracks/rust/exercises/beer-song/src/lib.rs +2 -2
- data/tracks/rust/exercises/bob/src/lib.rs +1 -1
- data/tracks/rust/exercises/circular-buffer/tests/circular-buffer.rs +96 -101
- data/tracks/rust/exercises/collatz-conjecture/src/lib.rs +4 -2
- data/tracks/rust/exercises/decimal/.meta/description.md +1 -1
- data/tracks/rust/exercises/decimal/README.md +1 -1
- data/tracks/rust/exercises/difference-of-squares/src/lib.rs +6 -3
- data/tracks/rust/exercises/forth/src/lib.rs +1 -1
- data/tracks/rust/exercises/grade-school/src/lib.rs +2 -4
- data/tracks/rust/exercises/grains/src/lib.rs +1 -1
- data/tracks/rust/exercises/leap/src/lib.rs +1 -1
- data/tracks/rust/exercises/macros/.meta/description.md +1 -1
- data/tracks/rust/exercises/macros/README.md +1 -1
- data/tracks/rust/exercises/ocr-numbers/src/lib.rs +1 -2
- data/tracks/rust/exercises/parallel-letter-frequency/.meta/hints.md +1 -1
- data/tracks/rust/exercises/parallel-letter-frequency/README.md +1 -1
- data/tracks/rust/exercises/pascals-triangle/src/lib.rs +1 -1
- data/tracks/rust/exercises/perfect-numbers/src/lib.rs +1 -1
- data/tracks/rust/exercises/prime-factors/src/lib.rs +1 -1
- data/tracks/rust/exercises/proverb/src/lib.rs +1 -1
- data/tracks/rust/exercises/raindrops/src/lib.rs +1 -1
- data/tracks/rust/exercises/react/src/lib.rs +11 -9
- data/tracks/rust/exercises/robot-simulator/src/lib.rs +6 -4
- data/tracks/rust/exercises/saddle-points/src/lib.rs +1 -1
- data/tracks/rust/exercises/simple-linked-list/src/lib.rs +5 -5
- data/tracks/rust/exercises/space-age/src/lib.rs +6 -3
- data/tracks/rust/exercises/sum-of-multiples/src/lib.rs +1 -1
- data/tracks/rust/exercises/two-bucket/src/lib.rs +7 -1
- data/tracks/rust/exercises/variable-length-quantity/src/lib.rs +2 -2
- data/tracks/typescript/exercises/list-ops/list-ops.example.ts +9 -13
- data/tracks/typescript/exercises/list-ops/list-ops.test.ts +9 -17
- metadata +8 -4
@@ -37,7 +37,7 @@ rustup run nightly cargo bench
|
|
37
37
|
|
38
38
|
Learn more about nightly Rust:
|
39
39
|
|
40
|
-
- [Nightly Rust](https://doc.rust-lang.org/book/
|
40
|
+
- [Nightly Rust](https://doc.rust-lang.org/book/second-edition/ch01-03-how-rust-is-made-and-nightly-rust.html)
|
41
41
|
- [Rustup: Working with nightly](https://github.com/rust-lang-nursery/rustup.rs#working-with-nightly-rust)
|
42
42
|
|
43
43
|
|
@@ -1,5 +1,3 @@
|
|
1
|
-
#[allow(unused_variables)]
|
2
|
-
|
3
1
|
// Because these are passed without & to some functions,
|
4
2
|
// it will probably be necessary for these two types to be Copy.
|
5
3
|
pub type CellID = ();
|
@@ -20,7 +18,7 @@ pub enum RemoveCallbackError {
|
|
20
18
|
pub struct Reactor<T> {
|
21
19
|
// Just so that the compiler doesn't complain about an unused type parameter.
|
22
20
|
// You probably want to delete this field.
|
23
|
-
dummy: T
|
21
|
+
dummy: ::std::marker::PhantomData<T>,
|
24
22
|
}
|
25
23
|
|
26
24
|
// You are guaranteed that Reactor will only be tested against types that are Copy + PartialEq.
|
@@ -30,7 +28,7 @@ impl <T: Copy + PartialEq> Reactor<T> {
|
|
30
28
|
}
|
31
29
|
|
32
30
|
// Creates an input cell with the specified initial value, returning its ID.
|
33
|
-
pub fn create_input(&mut self,
|
31
|
+
pub fn create_input(&mut self, _initial: T) -> CellID {
|
34
32
|
unimplemented!()
|
35
33
|
}
|
36
34
|
|
@@ -47,7 +45,7 @@ impl <T: Copy + PartialEq> Reactor<T> {
|
|
47
45
|
// Notice that there is no way to *remove* a cell.
|
48
46
|
// This means that you may assume, without checking, that if the dependencies exist at creation
|
49
47
|
// time they will continue to exist as long as the Reactor exists.
|
50
|
-
pub fn create_compute<F: Fn(&[T]) -> T>(&mut self,
|
48
|
+
pub fn create_compute<F: Fn(&[T]) -> T>(&mut self, _dependencies: &[CellID], _compute_func: F) -> Result<CellID, CellID> {
|
51
49
|
unimplemented!()
|
52
50
|
}
|
53
51
|
|
@@ -59,7 +57,7 @@ impl <T: Copy + PartialEq> Reactor<T> {
|
|
59
57
|
// It turns out this introduces a significant amount of extra complexity to this exercise.
|
60
58
|
// We chose not to cover this here, since this exercise is probably enough work as-is.
|
61
59
|
pub fn value(&self, id: CellID) -> Option<T> {
|
62
|
-
unimplemented!()
|
60
|
+
unimplemented!("Get the value of the cell whose id is {:?}", id)
|
63
61
|
}
|
64
62
|
|
65
63
|
// Sets the value of the specified input cell.
|
@@ -73,7 +71,7 @@ impl <T: Copy + PartialEq> Reactor<T> {
|
|
73
71
|
// a `set_value(&mut self, new_value: T)` method on `Cell`.
|
74
72
|
//
|
75
73
|
// As before, that turned out to add too much extra complexity.
|
76
|
-
pub fn set_value(&mut self,
|
74
|
+
pub fn set_value(&mut self, _id: CellID, _new_value: T) -> Result<(), SetValueError> {
|
77
75
|
unimplemented!()
|
78
76
|
}
|
79
77
|
|
@@ -89,7 +87,7 @@ impl <T: Copy + PartialEq> Reactor<T> {
|
|
89
87
|
// * Exactly once if the compute cell's value changed as a result of the set_value call.
|
90
88
|
// The value passed to the callback should be the final value of the compute cell after the
|
91
89
|
// set_value call.
|
92
|
-
pub fn add_callback<F: FnMut(T) -> ()>(&mut self,
|
90
|
+
pub fn add_callback<F: FnMut(T) -> ()>(&mut self, _id: CellID, _callback: F) -> Option<CallbackID> {
|
93
91
|
unimplemented!()
|
94
92
|
}
|
95
93
|
|
@@ -99,6 +97,10 @@ impl <T: Copy + PartialEq> Reactor<T> {
|
|
99
97
|
//
|
100
98
|
// A removed callback should no longer be called.
|
101
99
|
pub fn remove_callback(&mut self, cell: CellID, callback: CallbackID) -> Result<(), RemoveCallbackError> {
|
102
|
-
unimplemented!(
|
100
|
+
unimplemented!(
|
101
|
+
"Remove the callback identified by the CallbackID {:?} from the cell {:?}",
|
102
|
+
callback,
|
103
|
+
cell,
|
104
|
+
)
|
103
105
|
}
|
104
106
|
}
|
@@ -12,9 +12,12 @@ pub enum Direction {
|
|
12
12
|
pub struct Robot;
|
13
13
|
|
14
14
|
impl Robot {
|
15
|
-
#[allow(unused_variables)]
|
16
15
|
pub fn new(x: isize, y: isize, d: Direction) -> Self {
|
17
|
-
unimplemented!(
|
16
|
+
unimplemented!(
|
17
|
+
"Create a robot at (x, y) ({}, {}) facing {:?}",
|
18
|
+
x, y,
|
19
|
+
d,
|
20
|
+
)
|
18
21
|
}
|
19
22
|
|
20
23
|
pub fn turn_right(self) -> Self {
|
@@ -29,9 +32,8 @@ impl Robot {
|
|
29
32
|
unimplemented!()
|
30
33
|
}
|
31
34
|
|
32
|
-
#[allow(unused_variables)]
|
33
35
|
pub fn instructions(self, instructions: &str) -> Self {
|
34
|
-
unimplemented!()
|
36
|
+
unimplemented!("Follow the given sequence of instructions: {}", instructions)
|
35
37
|
}
|
36
38
|
|
37
39
|
pub fn position(&self) -> (isize, isize) {
|
@@ -1,7 +1,7 @@
|
|
1
1
|
pub struct SimpleLinkedList<T> {
|
2
2
|
// Delete this field
|
3
|
-
//
|
4
|
-
|
3
|
+
// dummy is needed to avoid unused parameter error during compilation
|
4
|
+
dummy: ::std::marker::PhantomData<T>,
|
5
5
|
}
|
6
6
|
|
7
7
|
impl<T> SimpleLinkedList<T> {
|
@@ -13,7 +13,7 @@ impl<T> SimpleLinkedList<T> {
|
|
13
13
|
unimplemented!()
|
14
14
|
}
|
15
15
|
|
16
|
-
pub fn push(&mut self,
|
16
|
+
pub fn push(&mut self, _element: T) {
|
17
17
|
unimplemented!()
|
18
18
|
}
|
19
19
|
|
@@ -34,13 +34,13 @@ impl<T: Clone> SimpleLinkedList<T> {
|
|
34
34
|
|
35
35
|
|
36
36
|
impl<'a, T: Clone> From<&'a [T]> for SimpleLinkedList<T> {
|
37
|
-
fn from(
|
37
|
+
fn from(_item: &[T]) -> Self {
|
38
38
|
unimplemented!()
|
39
39
|
}
|
40
40
|
}
|
41
41
|
|
42
42
|
impl<T> Into<Vec<T>> for SimpleLinkedList<T> {
|
43
|
-
fn into(
|
43
|
+
fn into(self) -> Vec<T> {
|
44
44
|
unimplemented!()
|
45
45
|
}
|
46
46
|
}
|
@@ -1,18 +1,21 @@
|
|
1
1
|
// The code below is a stub. Just enough to satisfy the compiler.
|
2
2
|
// In order to pass the tests you can add-to or change any of this code.
|
3
|
-
#![allow(unused_variables)]
|
4
3
|
|
4
|
+
#[derive(Debug)]
|
5
5
|
pub struct Duration;
|
6
6
|
|
7
7
|
impl From<u64> for Duration {
|
8
8
|
fn from(s: u64) -> Self {
|
9
|
-
unimplemented!()
|
9
|
+
unimplemented!("s, measured in seconds: {}", s)
|
10
10
|
}
|
11
11
|
}
|
12
12
|
|
13
13
|
pub trait Planet {
|
14
14
|
fn years_during(d: &Duration) -> f64 {
|
15
|
-
unimplemented!(
|
15
|
+
unimplemented!(
|
16
|
+
"convert a duration ({:?}) to the number of years on this planet for that duration",
|
17
|
+
d,
|
18
|
+
);
|
16
19
|
}
|
17
20
|
}
|
18
21
|
|
@@ -22,5 +22,11 @@ pub fn solve(capacity_1: u8,
|
|
22
22
|
goal: u8,
|
23
23
|
start_bucket: &Bucket) -> BucketStats
|
24
24
|
{
|
25
|
-
unimplemented!(
|
25
|
+
unimplemented!(
|
26
|
+
"Given one bucket of capacity {}, another of capacity {}, starting with {:?}, find pours to reach {}",
|
27
|
+
capacity_1,
|
28
|
+
capacity_2,
|
29
|
+
start_bucket,
|
30
|
+
goal,
|
31
|
+
);
|
26
32
|
}
|
@@ -6,10 +6,10 @@ pub enum Error {
|
|
6
6
|
|
7
7
|
/// Convert a list of numbers to a stream of bytes encoded with variable length encoding.
|
8
8
|
pub fn to_bytes(values: &[u32]) -> Vec<u8> {
|
9
|
-
unimplemented!()
|
9
|
+
unimplemented!("Convert the values {:?} to a list of bytes", values)
|
10
10
|
}
|
11
11
|
|
12
12
|
/// Given a stream of bytes, extract all numbers which are encoded in there.
|
13
13
|
pub fn from_bytes(bytes: &[u8]) -> Result<Vec<u32>, Error> {
|
14
|
-
unimplemented!()
|
14
|
+
unimplemented!("Convert the list of bytes {:?} to a list of numbers", bytes)
|
15
15
|
}
|
@@ -1,23 +1,22 @@
|
|
1
|
-
class List {
|
2
|
-
values:
|
1
|
+
class List<T> {
|
2
|
+
values: T[]
|
3
3
|
|
4
|
-
constructor(arr?:
|
4
|
+
constructor(arr?: T[]) {
|
5
5
|
this.values = arr || []
|
6
6
|
}
|
7
7
|
|
8
|
-
append(otherList: List) {
|
8
|
+
append(otherList: List<T>) {
|
9
9
|
for (const el of otherList.values) {
|
10
10
|
this.values.push(el)
|
11
11
|
}
|
12
12
|
return this
|
13
13
|
}
|
14
14
|
|
15
|
-
concat(otherList: List) {
|
15
|
+
concat(otherList: List<T>) {
|
16
16
|
return this.append(otherList)
|
17
17
|
}
|
18
18
|
|
19
|
-
|
20
|
-
filter(operation: any) {
|
19
|
+
filter(operation: (arg: T) => boolean) {
|
21
20
|
const filteredValues = []
|
22
21
|
for (const el of this.values) {
|
23
22
|
if (operation(el)) {
|
@@ -34,8 +33,7 @@ class List {
|
|
34
33
|
return length
|
35
34
|
}
|
36
35
|
|
37
|
-
|
38
|
-
map(operation: any) {
|
36
|
+
map(operation: (arg: T) => T) {
|
39
37
|
const mappedValues = []
|
40
38
|
for (const el of this.values) {
|
41
39
|
mappedValues.push(operation(el))
|
@@ -44,8 +42,7 @@ class List {
|
|
44
42
|
return this
|
45
43
|
}
|
46
44
|
|
47
|
-
|
48
|
-
foldl(operation: any, initialValue: any) {
|
45
|
+
foldl(operation: (arg1: T, arg2: T) => T, initialValue: T) {
|
49
46
|
let acc = initialValue
|
50
47
|
for (const el of this.values) {
|
51
48
|
acc = operation(acc, el)
|
@@ -53,8 +50,7 @@ class List {
|
|
53
50
|
return acc
|
54
51
|
}
|
55
52
|
|
56
|
-
|
57
|
-
foldr(operation: any, initialValue: any) {
|
53
|
+
foldr(operation: (arg1: T, arg2: T) => T, initialValue: T) {
|
58
54
|
let acc = initialValue
|
59
55
|
let index = this.length() - 1
|
60
56
|
while (index >= 0) {
|
@@ -9,7 +9,7 @@ describe('append entries to a list and return the new list', () => {
|
|
9
9
|
|
10
10
|
xit('empty list to list', () => {
|
11
11
|
const list1 = new List([1, 2, 3, 4])
|
12
|
-
const list2 = new List()
|
12
|
+
const list2 = new List<number>()
|
13
13
|
expect(list1.append(list2)).toEqual(list1)
|
14
14
|
})
|
15
15
|
|
@@ -39,14 +39,12 @@ describe('concat lists and lists of lists into new list', () => {
|
|
39
39
|
describe('filter list returning only values that satisfy the filter function', () => {
|
40
40
|
xit('empty list', () => {
|
41
41
|
const list1 = new List([])
|
42
|
-
|
43
|
-
expect(list1.filter((el: any) => el % 2 === 1).values).toEqual([])
|
42
|
+
expect(list1.filter((el: number) => el % 2 === 1).values).toEqual([])
|
44
43
|
})
|
45
44
|
|
46
45
|
xit('non empty list', () => {
|
47
46
|
const list1 = new List([1, 2, 3, 5])
|
48
|
-
|
49
|
-
expect(list1.filter((el: any) => el % 2 === 1).values).toEqual([1, 3, 5])
|
47
|
+
expect(list1.filter((el: number) => el % 2 === 1).values).toEqual([1, 3, 5])
|
50
48
|
})
|
51
49
|
})
|
52
50
|
|
@@ -65,42 +63,36 @@ describe('returns the length of a list', () => {
|
|
65
63
|
describe('returns a list of elements whose values equal the list value transformed by the mapping function', () => {
|
66
64
|
xit('empty list', () => {
|
67
65
|
const list1 = new List()
|
68
|
-
|
69
|
-
expect(list1.map((el: any) => ++el).values).toEqual([])
|
66
|
+
expect(list1.map((el: number) => ++el).values).toEqual([])
|
70
67
|
})
|
71
68
|
|
72
69
|
xit('non-empty list', () => {
|
73
70
|
const list1 = new List([1, 3, 5, 7])
|
74
|
-
|
75
|
-
expect(list1.map((el: any) => ++el).values).toEqual([2, 4, 6, 8])
|
71
|
+
expect(list1.map((el: number) => ++el).values).toEqual([2, 4, 6, 8])
|
76
72
|
})
|
77
73
|
})
|
78
74
|
|
79
75
|
describe('folds (reduces) the given list from the left with a function', () => {
|
80
76
|
xit('empty list', () => {
|
81
77
|
const list1 = new List()
|
82
|
-
|
83
|
-
expect(list1.foldl((acc: any, el: any) => el / acc, 2)).toEqual(2)
|
78
|
+
expect(list1.foldl((acc: number, el: number) => el / acc, 2)).toEqual(2)
|
84
79
|
})
|
85
80
|
|
86
81
|
xit('division of integers', () => {
|
87
82
|
const list1 = new List([1, 2, 3, 4])
|
88
|
-
|
89
|
-
expect(list1.foldl((acc: any, el: any) => el / acc, 24)).toEqual(64)
|
83
|
+
expect(list1.foldl((acc: number, el: number) => el / acc, 24)).toEqual(64)
|
90
84
|
})
|
91
85
|
})
|
92
86
|
|
93
87
|
describe('folds (reduces) the given list from the right with a function', () => {
|
94
88
|
xit('empty list', () => {
|
95
89
|
const list1 = new List()
|
96
|
-
|
97
|
-
expect(list1.foldr((acc: any, el: any) => el / acc, 2)).toEqual(2)
|
90
|
+
expect(list1.foldr((acc: number, el: number) => el / acc, 2)).toEqual(2)
|
98
91
|
})
|
99
92
|
|
100
93
|
xit('division of integers', () => {
|
101
94
|
const list1 = new List([1, 2, 3, 4])
|
102
|
-
|
103
|
-
expect(list1.foldr((acc: any, el: any) => el / acc, 24)).toEqual(9)
|
95
|
+
expect(list1.foldr((acc: number, el: number) => el / acc, 24)).toEqual(9)
|
104
96
|
})
|
105
97
|
})
|
106
98
|
|
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.
|
4
|
+
version: 2.2.1.130
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Katrina Owen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-04-
|
11
|
+
date: 2018-04-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubyzip
|
@@ -3428,13 +3428,11 @@ files:
|
|
3428
3428
|
- tracks/dart/exercises/raindrops/README.md
|
3429
3429
|
- tracks/dart/exercises/raindrops/lib/example.dart
|
3430
3430
|
- tracks/dart/exercises/raindrops/lib/raindrops.dart
|
3431
|
-
- tracks/dart/exercises/raindrops/pubspec.lock
|
3432
3431
|
- tracks/dart/exercises/raindrops/pubspec.yaml
|
3433
3432
|
- tracks/dart/exercises/raindrops/test/raindrops_test.dart
|
3434
3433
|
- tracks/dart/exercises/rna-transcription/README.md
|
3435
3434
|
- tracks/dart/exercises/rna-transcription/lib/example.dart
|
3436
3435
|
- tracks/dart/exercises/rna-transcription/lib/rna_transcription.dart
|
3437
|
-
- tracks/dart/exercises/rna-transcription/pubspec.lock
|
3438
3436
|
- tracks/dart/exercises/rna-transcription/pubspec.yaml
|
3439
3437
|
- tracks/dart/exercises/rna-transcription/test/rna_transcription_test.dart
|
3440
3438
|
- tracks/dart/exercises/word-count/README.md
|
@@ -11489,6 +11487,11 @@ files:
|
|
11489
11487
|
- tracks/purescript/exercises/pascals-triangle/examples/src/PascalsTriangle.purs
|
11490
11488
|
- tracks/purescript/exercises/pascals-triangle/src/PascalsTriangle.purs
|
11491
11489
|
- tracks/purescript/exercises/pascals-triangle/test/Main.purs
|
11490
|
+
- tracks/purescript/exercises/phone-number/README.md
|
11491
|
+
- tracks/purescript/exercises/phone-number/bower.json
|
11492
|
+
- tracks/purescript/exercises/phone-number/examples/src/PhoneNumber.purs
|
11493
|
+
- tracks/purescript/exercises/phone-number/src/PhoneNumber.purs
|
11494
|
+
- tracks/purescript/exercises/phone-number/test/Main.purs
|
11492
11495
|
- tracks/purescript/exercises/raindrops/README.md
|
11493
11496
|
- tracks/purescript/exercises/raindrops/bower.json
|
11494
11497
|
- tracks/purescript/exercises/raindrops/examples/src/Raindrops.purs
|
@@ -12772,6 +12775,7 @@ files:
|
|
12772
12775
|
- tracks/rust/README.md
|
12773
12776
|
- tracks/rust/_test/WINDOWS_README.md
|
12774
12777
|
- tracks/rust/_test/check-exercises.sh
|
12778
|
+
- tracks/rust/_test/check-stubs.sh
|
12775
12779
|
- tracks/rust/_test/count-ignores.sh
|
12776
12780
|
- tracks/rust/_test/ensure-lib-src-rs-exist.sh
|
12777
12781
|
- tracks/rust/_test/ensure-readmes-are-updated.sh
|