trackler 2.0.8.18 → 2.0.8.19
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/common/.gitignore +1 -0
- data/common/.travis.yml +5 -8
- data/common/README.md +18 -5
- data/common/exercises/grep/canonical-data.json +290 -269
- data/common/exercises/phone-number/canonical-data.json +2 -2
- data/common/exercises/pov/canonical-data.json +2 -5
- data/common/exercises/roman-numerals/canonical-data.json +112 -74
- data/common/exercises/tournament/canonical-data.json +86 -85
- data/common/exercises/two-bucket/canonical-data.json +55 -47
- data/common/package.json +16 -0
- data/common/yarn.lock +195 -0
- data/lib/trackler/version.rb +1 -1
- data/tracks/c/docs/LEARNING.md +1 -1
- data/tracks/c/exercises/space-age/src/example.c +15 -47
- data/tracks/c/exercises/space-age/src/example.h +12 -8
- data/tracks/c/exercises/space-age/test/test_space_age.c +8 -8
- data/tracks/ceylon/docs/TESTS.md +5 -2
- data/tracks/ceylon/exercises/TRACK_HINTS.md +5 -2
- data/tracks/csharp/.gitignore +0 -4
- data/tracks/csharp/.travis.yml +9 -20
- data/tracks/csharp/appveyor.yml +2 -4
- data/tracks/csharp/build.cake +95 -0
- data/tracks/csharp/build.ps1 +189 -0
- data/tracks/csharp/build.sh +99 -31
- data/tracks/csharp/circle.yml +3 -12
- data/tracks/delphi/config.json +8 -0
- data/tracks/delphi/exercises/minesweeper/MineSweeper.dpr +60 -0
- data/tracks/delphi/exercises/minesweeper/uMineSweeperExample.pas +70 -0
- data/tracks/delphi/exercises/minesweeper/uMineSweeperTest.pas +270 -0
- data/tracks/dlang/config.json +86 -31
- data/tracks/elixir/config.json +7 -0
- data/tracks/elixir/exercises/rotational-cipher/example.exs +35 -0
- data/tracks/elixir/exercises/rotational-cipher/rotational_cipher.exs +13 -0
- data/tracks/elixir/exercises/rotational-cipher/rotational_cipher_test.exs +80 -0
- data/tracks/go/exercises/raindrops/raindrops_test.go +4 -1
- data/tracks/go/exercises/react/react_test.go +6 -8
- data/tracks/go/exercises/rna-transcription/rna_transcription_test.go +4 -1
- data/tracks/go/exercises/robot-simulator/robot_simulator_test.go +5 -2
- data/tracks/haskell/exercises/allergies/src/Allergies.hs +2 -2
- data/tracks/haskell/exercises/atbash-cipher/src/Atbash.hs +2 -2
- data/tracks/haskell/exercises/bank-account/src/BankAccount.hs +3 -3
- data/tracks/haskell/exercises/binary-search-tree/src/BST.hs +7 -7
- data/tracks/haskell/exercises/bowling/src/Bowling.hs +1 -1
- data/tracks/haskell/exercises/clock/src/Clock.hs +4 -4
- data/tracks/haskell/exercises/connect/src/Connect.hs +1 -1
- data/tracks/haskell/exercises/crypto-square/src/CryptoSquare.hs +1 -1
- data/tracks/haskell/exercises/custom-set/src/CustomSet.hs +12 -12
- data/tracks/haskell/exercises/difference-of-squares/src/Squares.hs +3 -3
- data/tracks/haskell/exercises/etl/src/ETL.hs +1 -1
- data/tracks/haskell/exercises/forth/src/Forth.hs +2 -2
- data/tracks/haskell/exercises/go-counting/src/Counting.hs +2 -2
- data/tracks/haskell/exercises/kindergarten-garden/src/Garden.hs +3 -3
- data/tracks/haskell/exercises/largest-series-product/src/Series.hs +1 -1
- data/tracks/haskell/exercises/lens-person/src/Person.hs +4 -4
- data/tracks/julia/.travis.yml +3 -2
- data/tracks/ocaml/exercises/all-your-base/test.ml +2 -2
- data/tracks/ocaml/exercises/beer-song/test.ml +25 -24
- data/tracks/ocaml/exercises/phone-number/test.ml +22 -22
- data/tracks/ocaml/exercises/run-length-encoding/test.ml +5 -5
- data/tracks/ocaml/exercises/word-count/test.ml +1 -1
- data/tracks/ocaml/tools/test-generator/templates/beer-song/template.ml +20 -1
- data/tracks/purescript/config.json +7 -0
- data/tracks/purescript/exercises/word-count/bower.json +17 -0
- data/tracks/purescript/exercises/word-count/examples/src/WordCount.purs +31 -0
- data/tracks/purescript/exercises/word-count/src/WordCount.purs +3 -0
- data/tracks/purescript/exercises/word-count/test/Main.purs +89 -0
- data/tracks/python/exercises/accumulate/accumulate.py +2 -0
- data/tracks/python/exercises/acronym/acronym.py +2 -0
- data/tracks/python/exercises/allergies/allergies.py +3 -0
- data/tracks/python/exercises/allergies/example.py +1 -1
- data/tracks/python/exercises/anagram/anagram.py +2 -0
- data/tracks/python/exercises/atbash-cipher/atbash_cipher.py +6 -0
- data/tracks/python/exercises/beer-song/beer_song.py +6 -0
- data/tracks/python/exercises/binary-search/binary_search.py +2 -0
- data/tracks/python/exercises/binary/binary.py +2 -0
- data/tracks/python/exercises/bob/bob.py +2 -8
- data/tracks/python/exercises/bracket-push/bracket_push.py +2 -0
- data/tracks/python/exercises/circular-buffer/circular_buffer.py +11 -0
- data/tracks/python/exercises/clock/clock.py +3 -0
- data/tracks/python/exercises/clock/example.py +1 -1
- data/tracks/python/exercises/crypto-square/crypto_square.py +2 -0
- data/tracks/python/exercises/diamond/diamond.py +2 -0
- data/tracks/python/exercises/difference-of-squares/difference_of_squares.py +10 -0
- data/tracks/python/exercises/etl/etl.py +2 -0
- data/tracks/python/exercises/flatten-array/flatten_array.py +2 -0
- data/tracks/python/exercises/gigasecond/gigasecond.py +2 -0
- data/tracks/python/exercises/grade-school/grade_school.py +3 -0
- data/tracks/python/exercises/grains/grains.py +6 -0
- data/tracks/python/exercises/hamming/hamming.py +2 -0
- data/tracks/python/exercises/hello-world/hello_world.py +2 -7
- data/tracks/python/exercises/hexadecimal/hexadecimal.py +2 -0
- data/tracks/python/exercises/house/house.py +6 -0
- data/tracks/python/exercises/kindergarten-garden/kindergarten_garden.py +3 -0
- data/tracks/python/exercises/largest-series-product/largest_series_product.py +2 -0
- data/tracks/python/exercises/leap/leap.py +2 -0
- data/tracks/python/exercises/linked-list/linked_list.py +2 -8
- data/tracks/python/exercises/list-ops/list_ops.py +18 -22
- data/tracks/python/exercises/luhn/luhn.py +3 -0
- data/tracks/python/exercises/matrix/matrix.py +3 -0
- data/tracks/python/exercises/meetup/meetup.py +2 -0
- data/tracks/python/exercises/minesweeper/minesweeper.py +2 -0
- data/tracks/python/exercises/nth-prime/nth_prime.py +2 -0
- data/tracks/python/exercises/nucleotide-count/nucleotide_count.py +6 -0
- data/tracks/python/exercises/ocr-numbers/ocr_numbers.py +6 -0
- data/tracks/python/exercises/ocr-numbers/{ocr_test.py → ocr_numbers_test.py} +0 -0
- data/tracks/python/exercises/octal/octal.py +2 -0
- data/tracks/python/exercises/palindrome-products/palindrome_products.py +6 -0
- data/tracks/python/exercises/pangram/pangram.py +2 -0
- data/tracks/python/exercises/pascals-triangle/pascals_triangle.py +10 -0
- data/tracks/python/exercises/perfect-numbers/perfect_numbers.py +6 -0
- data/tracks/python/exercises/phone-number/phone_number.py +3 -0
- data/tracks/python/exercises/pig-latin/pig_latin.py +2 -0
- data/tracks/python/exercises/point-mutations/point_mutations.py +2 -0
- data/tracks/python/exercises/poker/poker.py +2 -0
- data/tracks/python/exercises/prime-factors/prime_factors.py +2 -0
- data/tracks/python/exercises/proverb/proverb.py +2 -0
- data/tracks/python/exercises/pythagorean-triplet/pythagorean_triplet.py +10 -0
- data/tracks/python/exercises/queen-attack/queen_attack.py +6 -0
- data/tracks/python/exercises/rail-fence-cipher/rail_fence_cipher.py +10 -0
- data/tracks/python/exercises/raindrops/raindrops.py +2 -0
- data/tracks/python/exercises/rectangles/example.py +1 -1
- data/tracks/python/exercises/rectangles/rectangles.py +2 -0
- data/tracks/python/exercises/rectangles/{rectangles_count_test.py → rectangles_test.py} +0 -0
- data/tracks/python/exercises/rna-transcription/rna_transcription.py +2 -0
- data/tracks/python/exercises/robot-name/robot_name.py +3 -0
- data/tracks/python/exercises/robot-simulator/robot_simulator.py +3 -0
- data/tracks/python/exercises/roman-numerals/roman_numerals.py +2 -0
- data/tracks/python/exercises/run-length-encoding/run_length_encoding.py +6 -0
- data/tracks/python/exercises/run-length-encoding/{run_length_test.py → run_length_encoding_test.py} +1 -1
- data/tracks/python/exercises/saddle-points/saddle_points.py +2 -0
- data/tracks/python/exercises/say/example.py +1 -1
- data/tracks/python/exercises/say/say.py +2 -0
- data/tracks/python/exercises/say/say_test.py +3 -0
- data/tracks/python/exercises/scrabble-score/scrabble_score.py +2 -0
- data/tracks/python/exercises/secret-handshake/secret_handshake.py +6 -0
- data/tracks/python/exercises/secret-handshake/{handshake_test.py → secret_handshake_test.py} +0 -0
- data/tracks/python/exercises/series/series.py +2 -0
- data/tracks/python/exercises/sieve/sieve.py +2 -0
- data/tracks/python/exercises/simple-cipher/example.py +1 -1
- data/tracks/python/exercises/simple-cipher/simple_cipher.py +8 -0
- data/tracks/python/exercises/space-age/space_age.py +3 -0
- data/tracks/python/exercises/strain/strain.py +6 -0
- data/tracks/python/exercises/sublist/sublist.py +2 -0
- data/tracks/python/exercises/sum-of-multiples/sum_of_multiples.py +2 -0
- data/tracks/python/exercises/triangle/triangle.py +7 -0
- data/tracks/python/exercises/trinary/trinary.py +2 -0
- data/tracks/python/exercises/twelve-days/twelve_days.py +10 -0
- data/tracks/python/exercises/word-count/word_count.py +2 -0
- data/tracks/python/exercises/wordy/wordy.py +2 -0
- data/tracks/python/exercises/zebra-puzzle/zebra_puzzle.py +2 -0
- data/tracks/ruby/exercises/beer-song/.meta/.version +1 -0
- data/tracks/ruby/exercises/beer-song/beer_song_test.rb +62 -36
- data/tracks/ruby/exercises/beer-song/example.rb +1 -5
- data/tracks/ruby/exercises/beer-song/example.tt +22 -0
- data/tracks/ruby/lib/beer_song_cases.rb +43 -0
- data/tracks/swift/exercises/matrix/Tests/MatrixTests/MatrixTests.swift +1 -1
- metadata +94 -13
- data/common/bin/jsonlint +0 -27
- data/tracks/csharp/.paket/paket.bootstrapper.exe +0 -0
- data/tracks/csharp/Zipper.cs +0 -137
- data/tracks/csharp/build.cmd +0 -14
- data/tracks/csharp/build.fsx +0 -78
- data/tracks/csharp/paket.dependencies +0 -2
- data/tracks/csharp/paket.lock +0 -3
data/tracks/elixir/config.json
CHANGED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
defmodule RotationalCipher do
|
|
2
|
+
@alphabet "abcdefghijklmnopqrstuvwxyz"
|
|
3
|
+
@alphabet_size String.length(@alphabet)
|
|
4
|
+
|
|
5
|
+
for shift <- 0..25 do
|
|
6
|
+
plain = String.split(@alphabet, "", trim: true)
|
|
7
|
+
cipher = @alphabet
|
|
8
|
+
|> Kernel.<>(@alphabet)
|
|
9
|
+
|> String.split("", trim: true)
|
|
10
|
+
|> Enum.drop(shift)
|
|
11
|
+
|> Enum.take(@alphabet_size)
|
|
12
|
+
for {p, c} <- Enum.zip(plain, cipher) do
|
|
13
|
+
def translate(unquote(p), unquote(shift)), do: unquote(c)
|
|
14
|
+
def translate(unquote(p |> String.upcase), unquote(shift)), do: unquote(c |> String.upcase)
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# Non a-zA-Z just returns the original character
|
|
19
|
+
def translate(plaintext, _), do: plaintext
|
|
20
|
+
|
|
21
|
+
@doc """
|
|
22
|
+
Given a plaintext and amount to shift by, return a rotated string.
|
|
23
|
+
|
|
24
|
+
Example:
|
|
25
|
+
iex> RotationalCipher.rotate("Attack at dawn", 13)
|
|
26
|
+
"Nggnpx ng qnja"
|
|
27
|
+
"""
|
|
28
|
+
@spec rotate(text :: String.t(), shift :: integer) :: String.t()
|
|
29
|
+
def rotate(text, shift) do
|
|
30
|
+
text
|
|
31
|
+
|> String.split("", trim: true)
|
|
32
|
+
|> Enum.map_join(&(translate(&1, shift)))
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
defmodule RotationalCipher do
|
|
2
|
+
@doc """
|
|
3
|
+
Given a plaintext and amount to shift by, return a rotated string.
|
|
4
|
+
|
|
5
|
+
Example:
|
|
6
|
+
iex> RotationalCipher.rotate("Attack at dawn", 13)
|
|
7
|
+
"Nggnpx ng qnja"
|
|
8
|
+
"""
|
|
9
|
+
@spec rotate(text :: String.t(), shift :: integer) :: String.t()
|
|
10
|
+
def rotate(text, shift) do
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
if !System.get_env("EXERCISM_TEST_EXAMPLES") do
|
|
2
|
+
Code.load_file("rotational_cipher.exs", __DIR__)
|
|
3
|
+
end
|
|
4
|
+
|
|
5
|
+
ExUnit.start
|
|
6
|
+
ExUnit.configure exclude: :pending, trace: true
|
|
7
|
+
|
|
8
|
+
defmodule RotationalCipherTest do
|
|
9
|
+
use ExUnit.Case
|
|
10
|
+
|
|
11
|
+
#@tag :pending
|
|
12
|
+
test "rotate a by 1" do
|
|
13
|
+
plaintext = "a"
|
|
14
|
+
shift = 1
|
|
15
|
+
assert RotationalCipher.rotate(plaintext, shift) == "b"
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
@tag :pending
|
|
19
|
+
test "rotate a by 26, same output as input" do
|
|
20
|
+
plaintext = "a"
|
|
21
|
+
shift = 26
|
|
22
|
+
assert RotationalCipher.rotate(plaintext, shift) == "a"
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
@tag :pending
|
|
26
|
+
test "rotate a by 0, same output as input" do
|
|
27
|
+
plaintext = "a"
|
|
28
|
+
shift = 0
|
|
29
|
+
assert RotationalCipher.rotate(plaintext, shift) == "a"
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
@tag :pending
|
|
33
|
+
test "rotate m by 13" do
|
|
34
|
+
plaintext = "m"
|
|
35
|
+
shift = 13
|
|
36
|
+
assert RotationalCipher.rotate(plaintext, shift) == "z"
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
@tag :pending
|
|
40
|
+
test "rotate n by 13 with wrap around alphabet" do
|
|
41
|
+
plaintext = "n"
|
|
42
|
+
shift = 13
|
|
43
|
+
assert RotationalCipher.rotate(plaintext, shift) == "a"
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
@tag :pending
|
|
47
|
+
test "rotate capital letters" do
|
|
48
|
+
plaintext = "OMG"
|
|
49
|
+
shift = 5
|
|
50
|
+
assert RotationalCipher.rotate(plaintext, shift) == "TRL"
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
@tag :pending
|
|
54
|
+
test "rotate spaces" do
|
|
55
|
+
plaintext = "O M G"
|
|
56
|
+
shift = 5
|
|
57
|
+
assert RotationalCipher.rotate(plaintext, shift) == "T R L"
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
@tag :pending
|
|
61
|
+
test "rotate numbers" do
|
|
62
|
+
plaintext = "Testing 1 2 3 testing"
|
|
63
|
+
shift = 4
|
|
64
|
+
assert RotationalCipher.rotate(plaintext, shift) == "Xiwxmrk 1 2 3 xiwxmrk"
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
@tag :pending
|
|
68
|
+
test "rotate punctuation" do
|
|
69
|
+
plaintext = "Let's eat, Grandma!"
|
|
70
|
+
shift = 21
|
|
71
|
+
assert RotationalCipher.rotate(plaintext, shift) == "Gzo'n zvo, Bmviyhv!"
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
@tag :pending
|
|
75
|
+
test "rotate all letters" do
|
|
76
|
+
plaintext = "The quick brown fox jumps over the lazy dog."
|
|
77
|
+
shift = 13
|
|
78
|
+
assert RotationalCipher.rotate(plaintext, shift) == "Gur dhvpx oebja sbk whzcf bire gur ynml qbt."
|
|
79
|
+
end
|
|
80
|
+
end
|
|
@@ -4,10 +4,13 @@ import "testing"
|
|
|
4
4
|
|
|
5
5
|
const targetTestVersion = 2
|
|
6
6
|
|
|
7
|
-
func
|
|
7
|
+
func TestTestVersion(t *testing.T) {
|
|
8
8
|
if testVersion != targetTestVersion {
|
|
9
9
|
t.Fatalf("Found testVersion = %v, want %v", testVersion, targetTestVersion)
|
|
10
10
|
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
func TestConvert(t *testing.T) {
|
|
11
14
|
for _, test := range tests {
|
|
12
15
|
if actual := Convert(test.input); actual != test.expected {
|
|
13
16
|
t.Errorf("Convert(%d) = %q, expected %q.",
|
|
@@ -16,14 +16,6 @@ const targetTestVersion = 5
|
|
|
16
16
|
// This is a compile time check to see if you've properly implemented New().
|
|
17
17
|
var _ Reactor = New()
|
|
18
18
|
|
|
19
|
-
// If this test fails and you've proprly defined testVersion the requirements
|
|
20
|
-
// of the tests have changed since you wrote your submission.
|
|
21
|
-
func TestTestVersion(t *testing.T) {
|
|
22
|
-
if testVersion != targetTestVersion {
|
|
23
|
-
t.Fatalf("Found testVersion = %v, want %v", testVersion, targetTestVersion)
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
19
|
func assertCellValue(t *testing.T, c Cell, expected int, explanation string) {
|
|
28
20
|
observed := c.Value()
|
|
29
21
|
_, _, line, _ := runtime.Caller(1)
|
|
@@ -32,6 +24,12 @@ func assertCellValue(t *testing.T, c Cell, expected int, explanation string) {
|
|
|
32
24
|
}
|
|
33
25
|
}
|
|
34
26
|
|
|
27
|
+
func TestTestVersion(t *testing.T) {
|
|
28
|
+
if testVersion != targetTestVersion {
|
|
29
|
+
t.Fatalf("Found testVersion = %v, want %v", testVersion, targetTestVersion)
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
35
33
|
// Setting the value of an input cell changes the observable Value()
|
|
36
34
|
func TestSetInput(t *testing.T) {
|
|
37
35
|
r := New()
|
|
@@ -4,10 +4,13 @@ import "testing"
|
|
|
4
4
|
|
|
5
5
|
const targetTestVersion = 3
|
|
6
6
|
|
|
7
|
-
func
|
|
7
|
+
func TestTestVersion(t *testing.T) {
|
|
8
8
|
if testVersion != targetTestVersion {
|
|
9
9
|
t.Fatalf("Found testVersion = %v, want %v", testVersion, targetTestVersion)
|
|
10
10
|
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
func TestRNATranscription(t *testing.T) {
|
|
11
14
|
for _, test := range rnaTests {
|
|
12
15
|
if actual := ToRNA(test.input); actual != test.expected {
|
|
13
16
|
t.Errorf("ToRNA(%s): %s, expected %s",
|
|
@@ -27,11 +27,14 @@ import (
|
|
|
27
27
|
|
|
28
28
|
const targetTestVersion = 3
|
|
29
29
|
|
|
30
|
-
func
|
|
31
|
-
|
|
30
|
+
func TestTestVersion(t *testing.T) {
|
|
32
31
|
if testVersion != targetTestVersion {
|
|
33
32
|
t.Fatalf("Found testVersion = %v, want %v", testVersion, targetTestVersion)
|
|
34
33
|
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
func TestStep1(t *testing.T) {
|
|
37
|
+
|
|
35
38
|
want := func(x, y int, dir Dir) {
|
|
36
39
|
_, _, line, _ := runtime.Caller(1)
|
|
37
40
|
if Step1Robot.X != x || Step1Robot.Y != y {
|
|
@@ -11,7 +11,7 @@ data Allergen = Eggs
|
|
|
11
11
|
deriving (Eq)
|
|
12
12
|
|
|
13
13
|
allergies :: Int -> [Allergen]
|
|
14
|
-
allergies = error "You need to implement this function."
|
|
14
|
+
allergies score = error "You need to implement this function."
|
|
15
15
|
|
|
16
16
|
isAllergicTo :: Allergen -> Int -> Bool
|
|
17
|
-
isAllergicTo = error "You need to implement this function."
|
|
17
|
+
isAllergicTo allergen score = error "You need to implement this function."
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
module Atbash (decode, encode) where
|
|
2
2
|
|
|
3
3
|
decode :: String -> String
|
|
4
|
-
decode = error "You need to implement this function."
|
|
4
|
+
decode phrase = error "You need to implement this function."
|
|
5
5
|
|
|
6
6
|
encode :: String -> String
|
|
7
|
-
encode = error "You need to implement this function."
|
|
7
|
+
encode phrase = error "You need to implement this function."
|
|
@@ -9,13 +9,13 @@ module BankAccount
|
|
|
9
9
|
data BankAccount = Dummy
|
|
10
10
|
|
|
11
11
|
closeAccount :: BankAccount -> IO ()
|
|
12
|
-
closeAccount = error "You need to implement this function."
|
|
12
|
+
closeAccount account = error "You need to implement this function."
|
|
13
13
|
|
|
14
14
|
getBalance :: BankAccount -> IO (Maybe Integer)
|
|
15
|
-
getBalance = error "You need to implement this function."
|
|
15
|
+
getBalance account = error "You need to implement this function."
|
|
16
16
|
|
|
17
17
|
incrementBalance :: BankAccount -> Integer -> IO (Maybe Integer)
|
|
18
|
-
incrementBalance = error "You need to implement this function."
|
|
18
|
+
incrementBalance account amount = error "You need to implement this function."
|
|
19
19
|
|
|
20
20
|
openAccount :: IO BankAccount
|
|
21
21
|
openAccount = error "You need to implement this function."
|
|
@@ -13,25 +13,25 @@ module BST
|
|
|
13
13
|
data BST a = Dummy deriving (Eq, Show)
|
|
14
14
|
|
|
15
15
|
bstLeft :: BST a -> Maybe (BST a)
|
|
16
|
-
bstLeft = error "You need to implement this function."
|
|
16
|
+
bstLeft tree = error "You need to implement this function."
|
|
17
17
|
|
|
18
18
|
bstRight :: BST a -> Maybe (BST a)
|
|
19
|
-
bstRight = error "You need to implement this function."
|
|
19
|
+
bstRight tree = error "You need to implement this function."
|
|
20
20
|
|
|
21
21
|
bstValue :: BST a -> Maybe a
|
|
22
|
-
bstValue = error "You need to implement this function."
|
|
22
|
+
bstValue tree = error "You need to implement this function."
|
|
23
23
|
|
|
24
24
|
empty :: BST a
|
|
25
25
|
empty = error "You need to implement this function."
|
|
26
26
|
|
|
27
27
|
fromList :: Ord a => [a] -> BST a
|
|
28
|
-
fromList = error "You need to implement this function."
|
|
28
|
+
fromList xs = error "You need to implement this function."
|
|
29
29
|
|
|
30
30
|
insert :: Ord a => a -> BST a -> BST a
|
|
31
|
-
insert = error "You need to implement this function."
|
|
31
|
+
insert x tree = error "You need to implement this function."
|
|
32
32
|
|
|
33
33
|
singleton :: a -> BST a
|
|
34
|
-
singleton = error "You need to implement this function."
|
|
34
|
+
singleton x = error "You need to implement this function."
|
|
35
35
|
|
|
36
36
|
toList :: BST a -> [a]
|
|
37
|
-
toList = error "You need to implement this function."
|
|
37
|
+
toList tree = error "You need to implement this function."
|
|
@@ -3,13 +3,13 @@ module Clock (clockHour, clockMin, fromHourMin, toString) where
|
|
|
3
3
|
data Clock = Dummy
|
|
4
4
|
|
|
5
5
|
clockHour :: Clock -> Int
|
|
6
|
-
clockHour = error "You need to implement this function."
|
|
6
|
+
clockHour clock = error "You need to implement this function."
|
|
7
7
|
|
|
8
8
|
clockMin :: Clock -> Int
|
|
9
|
-
clockMin = error "You need to implement this function."
|
|
9
|
+
clockMin clock = error "You need to implement this function."
|
|
10
10
|
|
|
11
11
|
fromHourMin :: Int -> Int -> Clock
|
|
12
|
-
fromHourMin = error "You need to implement this function."
|
|
12
|
+
fromHourMin hour min = error "You need to implement this function."
|
|
13
13
|
|
|
14
14
|
toString :: Clock -> String
|
|
15
|
-
toString = error "You need to implement this function."
|
|
15
|
+
toString clock = error "You need to implement this function."
|
|
@@ -19,40 +19,40 @@ import Prelude hiding (null)
|
|
|
19
19
|
data CustomSet a = Dummy deriving (Eq, Show)
|
|
20
20
|
|
|
21
21
|
delete :: a -> CustomSet a -> CustomSet a
|
|
22
|
-
delete = error "You need to implement this function."
|
|
22
|
+
delete x set = error "You need to implement this function."
|
|
23
23
|
|
|
24
24
|
difference :: CustomSet a -> CustomSet a -> CustomSet a
|
|
25
|
-
difference = error "You need to implement this function."
|
|
25
|
+
difference setA setB = error "You need to implement this function."
|
|
26
26
|
|
|
27
27
|
empty :: CustomSet a
|
|
28
28
|
empty = error "You need to implement this function."
|
|
29
29
|
|
|
30
30
|
fromList :: [a] -> CustomSet a
|
|
31
|
-
fromList = error "You need to implement this function."
|
|
31
|
+
fromList xs = error "You need to implement this function."
|
|
32
32
|
|
|
33
33
|
insert :: a -> CustomSet a -> CustomSet a
|
|
34
|
-
insert = error "You need to implement this function."
|
|
34
|
+
insert x set = error "You need to implement this function."
|
|
35
35
|
|
|
36
36
|
intersection :: CustomSet a -> CustomSet a -> CustomSet a
|
|
37
|
-
intersection = error "You need to implement this function."
|
|
37
|
+
intersection setA setB = error "You need to implement this function."
|
|
38
38
|
|
|
39
39
|
isDisjointFrom :: CustomSet a -> CustomSet a -> Bool
|
|
40
|
-
isDisjointFrom = error "You need to implement this function."
|
|
40
|
+
isDisjointFrom setA setB = error "You need to implement this function."
|
|
41
41
|
|
|
42
42
|
isSubsetOf :: CustomSet a -> CustomSet a -> Bool
|
|
43
|
-
isSubsetOf = error "You need to implement this function."
|
|
43
|
+
isSubsetOf setA setB = error "You need to implement this function."
|
|
44
44
|
|
|
45
45
|
member :: a -> CustomSet a -> Bool
|
|
46
|
-
member = error "You need to implement this function."
|
|
46
|
+
member x set = error "You need to implement this function."
|
|
47
47
|
|
|
48
48
|
null :: CustomSet a -> Bool
|
|
49
|
-
null = error "You need to implement this function."
|
|
49
|
+
null set = error "You need to implement this function."
|
|
50
50
|
|
|
51
51
|
size :: CustomSet a -> Int
|
|
52
|
-
size = error "You need to implement this function."
|
|
52
|
+
size set = error "You need to implement this function."
|
|
53
53
|
|
|
54
54
|
toList :: CustomSet a -> [a]
|
|
55
|
-
toList = error "You need to implement this function."
|
|
55
|
+
toList set = error "You need to implement this function."
|
|
56
56
|
|
|
57
57
|
union :: CustomSet a -> CustomSet a -> CustomSet a
|
|
58
|
-
union = error "You need to implement this function."
|
|
58
|
+
union setA setB = error "You need to implement this function."
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
module Squares (difference, squareOfSums, sumOfSquares) where
|
|
2
2
|
|
|
3
3
|
difference :: Integral a => a -> a
|
|
4
|
-
difference = error "You need to implement this function."
|
|
4
|
+
difference n = error "You need to implement this function."
|
|
5
5
|
|
|
6
6
|
squareOfSums :: Integral a => a -> a
|
|
7
|
-
squareOfSums = error "You need to implement this function."
|
|
7
|
+
squareOfSums n = error "You need to implement this function."
|
|
8
8
|
|
|
9
9
|
sumOfSquares :: Integral a => a -> a
|
|
10
|
-
sumOfSquares = error "You need to implement this function."
|
|
10
|
+
sumOfSquares n = error "You need to implement this function."
|
|
@@ -23,7 +23,7 @@ empty :: ForthState
|
|
|
23
23
|
empty = error "You need to implement this function."
|
|
24
24
|
|
|
25
25
|
evalText :: Text -> ForthState -> Either ForthError ForthState
|
|
26
|
-
evalText = error "You need to implement this function."
|
|
26
|
+
evalText text stack = error "You need to implement this function."
|
|
27
27
|
|
|
28
28
|
toList :: ForthState -> [Int]
|
|
29
|
-
toList = error "You need to implement this function."
|
|
29
|
+
toList stack = error "You need to implement this function."
|
|
@@ -10,7 +10,7 @@ data Color = Black | White deriving (Eq, Ord, Show)
|
|
|
10
10
|
type Coord = (Int, Int)
|
|
11
11
|
|
|
12
12
|
territories :: [String] -> [(Set Coord, Maybe Color)]
|
|
13
|
-
territories = error "You need to implement this function."
|
|
13
|
+
territories board = error "You need to implement this function."
|
|
14
14
|
|
|
15
15
|
territoryFor :: [String] -> Coord -> Maybe (Set Coord, Maybe Color)
|
|
16
|
-
territoryFor = error "You need to implement this function."
|
|
16
|
+
territoryFor board coord = error "You need to implement this function."
|
|
@@ -14,10 +14,10 @@ data Plant = Clover
|
|
|
14
14
|
deriving (Eq, Show)
|
|
15
15
|
|
|
16
16
|
defaultGarden :: String -> Map String [Plant]
|
|
17
|
-
defaultGarden = error "You need to implement this function."
|
|
17
|
+
defaultGarden plants = error "You need to implement this function."
|
|
18
18
|
|
|
19
19
|
garden :: [String] -> String -> Map String [Plant]
|
|
20
|
-
garden = error "You need to implement this function."
|
|
20
|
+
garden students plants = error "You need to implement this function."
|
|
21
21
|
|
|
22
22
|
lookupPlants :: String -> Map String [Plant] -> [Plant]
|
|
23
|
-
lookupPlants = error "You need to implement this function."
|
|
23
|
+
lookupPlants student garden = error "You need to implement this function."
|