trackler 2.2.1.100 → 2.2.1.101
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/trackler/version.rb +1 -1
- data/problem-specifications/exercises/kindergarten-garden/canonical-data.json +37 -19
- data/problem-specifications/exercises/ocr-numbers/canonical-data.json +144 -110
- data/problem-specifications/exercises/palindrome-products/canonical-data.json +49 -25
- data/problem-specifications/exercises/poker/canonical-data.json +171 -115
- data/problem-specifications/exercises/prime-factors/canonical-data.json +22 -8
- data/problem-specifications/exercises/protein-translation/canonical-data.json +70 -24
- data/problem-specifications/exercises/proverb/canonical-data.json +24 -12
- data/problem-specifications/exercises/queen-attack/canonical-data.json +115 -91
- data/problem-specifications/exercises/rail-fence-cipher/canonical-data.json +25 -13
- data/problem-specifications/exercises/raindrops/canonical-data.json +55 -19
- data/problem-specifications/exercises/rational-numbers/canonical-data.json +374 -0
- data/problem-specifications/exercises/rational-numbers/description.md +27 -0
- data/problem-specifications/exercises/rational-numbers/metadata.yml +4 -0
- data/problem-specifications/exercises/rectangles/canonical-data.json +93 -67
- data/problem-specifications/exercises/reverse-string/canonical-data.json +16 -6
- data/problem-specifications/exercises/rna-transcription/metadata.yml +3 -3
- data/problem-specifications/exercises/roman-numerals/canonical-data.json +10 -2
- data/tracks/bash/config.json +11 -11
- data/tracks/c/exercises/roman-numerals/test/test_roman_numerals.c +7 -0
- data/tracks/clojure/exercises/armstrong-numbers/README.md +1 -1
- data/tracks/delphi/config.json +11 -0
- data/tracks/delphi/exercises/clock/uClockExample.pas +6 -1
- data/tracks/delphi/exercises/clock/uClockTest.pas +22 -19
- data/tracks/delphi/exercises/isbn-verifier/README.md +1 -1
- data/tracks/delphi/exercises/reverse-string/README.md +1 -1
- data/tracks/delphi/exercises/rna-transcription/README.md +1 -1
- data/tracks/delphi/exercises/roman-numerals/uRomanNumeralsTest.pas +14 -0
- data/tracks/delphi/exercises/space-age/README.md +45 -0
- data/tracks/delphi/exercises/space-age/SpaceAge.dpr +60 -0
- data/tracks/delphi/exercises/space-age/uSpaceAgeExample.pas +120 -0
- data/tracks/delphi/exercises/space-age/uSpaceAgeTests.pas +135 -0
- data/tracks/delphi/exercises/two-fer/README.md +1 -1
- data/tracks/elixir/exercises/nth-prime/nth_prime.exs +0 -1
- data/tracks/fsharp/exercises/pov/PovTest.fs +66 -53
- data/tracks/fsharp/exercises/space-age/Example.fs +11 -11
- data/tracks/fsharp/exercises/space-age/SpaceAge.fs +1 -1
- data/tracks/fsharp/exercises/space-age/SpaceAgeTest.fs +21 -34
- data/tracks/fsharp/exercises/triangle/Example.fs +11 -16
- data/tracks/fsharp/exercises/triangle/Triangle.fs +4 -5
- data/tracks/fsharp/exercises/triangle/TriangleTest.fs +44 -31
- data/tracks/fsharp/generators/Generators.fs +121 -0
- data/tracks/go/config.json +12 -0
- data/tracks/go/exercises/clock/.meta/gen.go +37 -13
- data/tracks/go/exercises/clock/cases_test.go +10 -10
- data/tracks/go/exercises/clock/clock_test.go +16 -2
- data/tracks/go/exercises/clock/example.go +4 -0
- data/tracks/go/exercises/clock/example_clock_test.go +3 -3
- data/tracks/go/exercises/parallel-letter-frequency/.meta/hints.md +33 -0
- data/tracks/go/exercises/parallel-letter-frequency/README.md +35 -0
- data/tracks/go/exercises/raindrops/.meta/hints.md +7 -4
- data/tracks/go/exercises/raindrops/README.md +12 -0
- data/tracks/go/exercises/roman-numerals/.meta/gen.go +4 -2
- data/tracks/go/exercises/roman-numerals/cases_test.go +3 -2
- data/tracks/go/exercises/space-age/.meta/hints.md +10 -0
- data/tracks/go/exercises/space-age/README.md +14 -1
- data/tracks/go/exercises/twelve-days/README.md +2 -5
- data/tracks/go/exercises/two-bucket/.meta/gen.go +62 -0
- data/tracks/go/exercises/two-bucket/.meta/hints.md +16 -0
- data/tracks/go/exercises/two-bucket/README.md +72 -0
- data/tracks/go/exercises/two-bucket/cases_test.go +44 -0
- data/tracks/go/exercises/two-bucket/example.go +198 -0
- data/tracks/go/exercises/two-bucket/two_bucket_test.go +61 -0
- data/tracks/idris/.travis.yml +3 -2
- data/tracks/idris/bin/fetch-idris-testing.sh +11 -0
- data/tracks/idris/bin/solve_exercises.sh +2 -2
- data/tracks/idris/config.json +11 -0
- data/tracks/idris/config/exercise_readme.go.tmpl +0 -3
- data/tracks/idris/docs/INSTALLATION.md +22 -0
- data/tracks/idris/docs/TESTS.md +12 -4
- data/tracks/idris/exercises/accumulate/src/Accumulate.idr +5 -0
- data/tracks/idris/exercises/hamming/Hamming.ipkg +2 -0
- data/tracks/idris/exercises/hamming/src/{example.idr → Example.idr} +5 -1
- data/tracks/idris/exercises/hamming/src/Hamming.idr +13 -5
- data/tracks/idris/exercises/hamming/src/Test/Hamming.idr +31 -58
- data/tracks/idris/exercises/hello-world/HelloWorld.ipkg +2 -0
- data/tracks/idris/exercises/hello-world/src/Example.idr +9 -0
- data/tracks/idris/exercises/hello-world/src/HelloWorld.idr +6 -1
- data/tracks/idris/exercises/hello-world/src/Test/HelloWorld.idr +18 -18
- data/tracks/idris/exercises/leap/Leap.ipkg +2 -0
- data/tracks/idris/exercises/leap/src/{example.idr → Example.idr} +4 -0
- data/tracks/idris/exercises/leap/src/Leap.idr +5 -1
- data/tracks/idris/exercises/leap/src/Test/Leap.idr +21 -30
- data/tracks/idris/exercises/rna-transcription/Makefile +23 -0
- data/tracks/idris/exercises/rna-transcription/README.md +27 -0
- data/tracks/idris/exercises/rna-transcription/RnaTranscription.ipkg +5 -0
- data/tracks/idris/exercises/rna-transcription/src/RnaTranscription.idr +17 -0
- data/tracks/idris/exercises/rna-transcription/src/Test/RnaTranscription.idr +27 -0
- data/tracks/idris/exercises/rna-transcription/src/example.idr +35 -0
- data/tracks/java/exercises/etl/.meta/version +1 -0
- data/tracks/java/exercises/gigasecond/.meta/version +1 -0
- data/tracks/java/exercises/isbn-verifier/README.md +1 -1
- data/tracks/java/exercises/nucleotide-count/.meta/src/reference/java/NucleotideCounter.java +7 -1
- data/tracks/java/exercises/nucleotide-count/.meta/version +1 -0
- data/tracks/java/exercises/nucleotide-count/src/test/java/NucleotideCounterTest.java +19 -54
- data/tracks/java/exercises/proverb/.meta/version +1 -0
- data/tracks/java/exercises/reverse-string/README.md +1 -1
- data/tracks/java/exercises/rna-transcription/README.md +1 -1
- data/tracks/java/exercises/sum-of-multiples/.meta/version +1 -0
- data/tracks/java/exercises/sum-of-multiples/src/test/java/SumOfMultiplesTest.java +13 -1
- data/tracks/kotlin/config/exercise_readme.go.tmpl +0 -3
- data/tracks/kotlin/docs/TESTS.md +1 -1
- data/tracks/objective-c/config.json +11 -0
- data/tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureExample.h +7 -0
- data/tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureExample.m +26 -0
- data/tracks/objective-c/exercises/collatz-conjecture/CollatzConjectureTest.m +39 -0
- data/tracks/objective-c/xcodeProject/ObjectiveC.xcodeproj/project.pbxproj +31 -1
- data/tracks/objective-c/xcodeProject/ObjectiveC.xcodeproj/xcshareddata/xcschemes/OCLint.xcscheme +3 -1
- data/tracks/objective-c/xcodeProject/ObjectiveC.xcodeproj/xcshareddata/xcschemes/xobjectivecTest.xcscheme +3 -1
- data/tracks/ocaml/exercises/forth/example.ml +9 -9
- data/tracks/ocaml/tools/test-generator/Makefile +3 -9
- data/tracks/ocaml/tools/test-generator/src/test_gen.ml +18 -16
- data/tracks/perl6/exercises/acronym/.meta/exercise-data.yaml +1 -1
- data/tracks/perl6/exercises/acronym/acronym.t +4 -14
- data/tracks/perl6/exercises/all-your-base/all-your-base.t +0 -2
- data/tracks/perl6/exercises/allergies/allergies.t +0 -2
- data/tracks/perl6/exercises/anagram/.meta/exercise-data.yaml +1 -1
- data/tracks/perl6/exercises/anagram/anagram.t +2 -40
- data/tracks/perl6/exercises/atbash-cipher/atbash-cipher.t +0 -1
- data/tracks/perl6/exercises/bob/bob.t +0 -2
- data/tracks/perl6/exercises/clock/.meta/exercise-data.yaml +15 -11
- data/tracks/perl6/exercises/clock/.meta/solutions/Clock.pm6 +5 -1
- data/tracks/perl6/exercises/clock/Clock.pm6 +1 -1
- data/tracks/perl6/exercises/clock/clock.t +314 -217
- data/tracks/perl6/exercises/etl/etl.t +0 -2
- data/tracks/perl6/exercises/flatten-array/flatten-array.t +0 -2
- data/tracks/perl6/exercises/grains/grains.t +0 -2
- data/tracks/perl6/exercises/hamming/.meta/exercise-data.yaml +2 -2
- data/tracks/perl6/exercises/hamming/hamming.t +63 -35
- data/tracks/perl6/exercises/hello-world/hello-world.t +2 -3
- data/tracks/perl6/exercises/leap/.meta/exercise-data.yaml +1 -1
- data/tracks/perl6/exercises/leap/leap.t +14 -8
- data/tracks/perl6/exercises/luhn/luhn.t +0 -2
- data/tracks/perl6/exercises/nucleotide-count/.meta/exercise-data.yaml +2 -2
- data/tracks/perl6/exercises/nucleotide-count/nucleotide-count.t +18 -10
- data/tracks/perl6/exercises/pangram/.meta/exercise-data.yaml +1 -1
- data/tracks/perl6/exercises/pangram/pangram.t +32 -14
- data/tracks/perl6/exercises/phone-number/.meta/exercise-data.yaml +4 -4
- data/tracks/perl6/exercises/phone-number/.meta/solutions/Phone.pm6 +1 -1
- data/tracks/perl6/exercises/phone-number/Phone.pm6 +1 -1
- data/tracks/perl6/exercises/phone-number/phone-number.t +59 -21
- data/tracks/perl6/exercises/raindrops/raindrops.t +0 -2
- data/tracks/perl6/exercises/rna-transcription/.meta/exercise-data.yaml +1 -1
- data/tracks/perl6/exercises/rna-transcription/README.md +1 -1
- data/tracks/perl6/exercises/rna-transcription/rna-transcription.t +17 -9
- data/tracks/perl6/exercises/roman-numerals/.meta/exercise-data.yaml +3 -3
- data/tracks/perl6/exercises/roman-numerals/.meta/solutions/RomanNumerals.pm6 +1 -1
- data/tracks/perl6/exercises/roman-numerals/RomanNumerals.pm6 +1 -1
- data/tracks/perl6/exercises/roman-numerals/roman-numerals.t +66 -24
- data/tracks/perl6/exercises/scrabble-score/.meta/exercise-data.yaml +1 -1
- data/tracks/perl6/exercises/scrabble-score/scrabble-score.t +35 -15
- data/tracks/perl6/exercises/space-age/.meta/exercise-data.yaml +1 -1
- data/tracks/perl6/exercises/space-age/space-age.t +34 -20
- data/tracks/perl6/exercises/two-fer/.meta/exercise-data.yaml +2 -2
- data/tracks/perl6/exercises/two-fer/two-fer.t +15 -11
- data/tracks/perl6/exercises/word-count/.meta/exercise-data.yaml +1 -1
- data/tracks/perl6/exercises/word-count/word-count.t +46 -26
- data/tracks/perl6/exercises/wordy/.meta/exercise-data.yaml +2 -2
- data/tracks/perl6/exercises/wordy/wordy.t +51 -21
- data/tracks/perl6/lib/Exercism/Generator.pm6 +1 -1
- data/tracks/perl6/t/generated-tests.t +1 -1
- data/tracks/perl6/templates/test.mustache +0 -1
- data/tracks/python/config.json +12 -0
- data/tracks/python/exercises/forth/example.py +1 -1
- data/tracks/python/exercises/forth/forth_test.py +43 -38
- data/tracks/python/exercises/spiral-matrix/README.md +42 -0
- data/tracks/python/exercises/spiral-matrix/example.py +11 -0
- data/tracks/python/exercises/spiral-matrix/spiral_matrix.py +2 -0
- data/tracks/python/exercises/spiral-matrix/spiral_matrix_test.py +40 -0
- data/tracks/racket/config/exercise_readme.go.tmpl +24 -4
- data/tracks/racket/exercises/accumulate/README.md +3 -6
- data/tracks/racket/exercises/acronym/README.md +3 -4
- data/tracks/racket/exercises/allergies/README.md +3 -4
- data/tracks/racket/exercises/anagram/README.md +3 -3
- data/tracks/racket/exercises/bob/README.md +5 -3
- data/tracks/racket/exercises/collatz-conjecture/README.md +3 -3
- data/tracks/racket/exercises/difference-of-squares/README.md +3 -3
- data/tracks/racket/exercises/etl/README.md +6 -4
- data/tracks/racket/exercises/gigasecond/README.md +3 -3
- data/tracks/racket/exercises/grains/README.md +3 -4
- data/tracks/racket/exercises/grep/README.md +15 -15
- data/tracks/racket/exercises/hamming/README.md +3 -3
- data/tracks/racket/exercises/hello-world/README.md +1 -1
- data/tracks/racket/exercises/leap/README.md +4 -4
- data/tracks/racket/exercises/list-ops/README.md +3 -4
- data/tracks/racket/exercises/meetup/README.md +19 -15
- data/tracks/racket/exercises/nucleotide-count/README.md +11 -25
- data/tracks/racket/exercises/perfect-numbers/README.md +5 -5
- data/tracks/racket/exercises/phone-number/README.md +7 -6
- data/tracks/racket/exercises/raindrops/README.md +3 -3
- data/tracks/racket/exercises/rna-transcription/README.md +4 -4
- data/tracks/racket/exercises/roman-numerals/README.md +4 -4
- data/tracks/racket/exercises/say/README.md +3 -3
- data/tracks/racket/exercises/scrabble-score/README.md +6 -4
- data/tracks/racket/exercises/word-count/README.md +4 -5
- data/tracks/scheme/config/exercise_readme.go.tmpl +0 -3
- data/tracks/scheme/docs/INSTALLATION.md +23 -14
- metadata +40 -9
- data/tracks/idris/docs/EXERCISE_README_INSERT.md +0 -0
- data/tracks/idris/exercises/hello-world/src/example.idr +0 -5
- data/tracks/kotlin/config/exercise-readme-insert.md +0 -1
- data/tracks/racket/docs/EXERCISE_README_INSERT.md +0 -23
- data/tracks/scheme/docs/EXERCISE_README_INSERT.md +0 -0
@@ -1,8 +1,11 @@
|
|
1
|
+
## Prerequisites
|
2
|
+
|
1
3
|
Before installing Idris, you will need to make sure you have all of the necessary libraries and tools. You will need:
|
2
4
|
|
3
5
|
* A fairly recent Haskell platform. Version 2013.2.0.0 should be sufficiently recent, though it is better to be completely up to date.
|
4
6
|
* The GNU Multiple Precision Arithmetic Library (GMP) is available from MacPorts/Homebrew and all major Linux distributions.
|
5
7
|
|
8
|
+
## Idris
|
6
9
|
|
7
10
|
The easiest way to install Idris, if you have all of the prerequisites, is to type:
|
8
11
|
|
@@ -13,3 +16,22 @@ cabal update; cabal install idris
|
|
13
16
|
This will install the latest version released on Hackage, along with any dependencies.
|
14
17
|
If, however, you would like the most up to date development version you can find it,
|
15
18
|
as well as build instructions, on GitHub at: https://github.com/idris-lang/Idris-dev.
|
19
|
+
|
20
|
+
## Necessary libraries
|
21
|
+
|
22
|
+
You also need to install some Idris libraries, which are requirements of our testsuite.
|
23
|
+
|
24
|
+
### `idris-testing`
|
25
|
+
|
26
|
+
This library provides the actual testing framework we use. It's installation is pretty simple.
|
27
|
+
|
28
|
+
```shell
|
29
|
+
pushd /tmp
|
30
|
+
git clone git clone git@github.com:jfdm/idris-testing.git
|
31
|
+
cd idris-testing
|
32
|
+
make lib
|
33
|
+
make install # depending on your installation of idris this might need to be run as root
|
34
|
+
popd
|
35
|
+
```
|
36
|
+
|
37
|
+
If the tests will ever brake because of calling things that your installed version of `idris-testing` does not provide, you have to update it by repeating the steps above.
|
data/tracks/idris/docs/TESTS.md
CHANGED
@@ -1,7 +1,15 @@
|
|
1
|
-
|
1
|
+
## GNU Make
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
There is a `Makefile` provided with every exercise, so it is sufficient to simply run
|
4
|
+
|
5
|
+
```shell
|
6
|
+
make
|
5
7
|
```
|
6
8
|
|
7
|
-
|
9
|
+
## Idris-PKG
|
10
|
+
|
11
|
+
The `Makefile` mentioned above is just a wrapper around the `idris` executable, which has some simple package management stuff built in.
|
12
|
+
|
13
|
+
```shell
|
14
|
+
idris --testpkg *.ipkg
|
15
|
+
```
|
@@ -16,4 +16,8 @@ implementation Eq Nucleotide where
|
|
16
16
|
export
|
17
17
|
hamming_distance : Eq a => Vect n a -> Vect n a -> Nat
|
18
18
|
hamming_distance s1 s2 =
|
19
|
-
fst $ filter ((/=) 0) $ map (\(n1,n2) => if n1 == n2 then 0 else 1) $ zip s1 s2
|
19
|
+
fst $ filter ((/=) 0) $ map (\(n1,n2) => if n1 == n2 then 0 else 1) $ zip s1 s2
|
20
|
+
|
21
|
+
export
|
22
|
+
version : String
|
23
|
+
version = "1.0.0"
|
@@ -2,9 +2,17 @@ module Hamming
|
|
2
2
|
|
3
3
|
import Data.Vect
|
4
4
|
|
5
|
-
|
6
|
-
data Nucleotide
|
5
|
+
public export
|
6
|
+
data Nucleotide = A | C | G | T
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
public export
|
9
|
+
implementation Eq Nucleotide where
|
10
|
+
l == r = ?eq_rhs
|
11
|
+
|
12
|
+
export
|
13
|
+
hamming_distance : Eq a => Vect n a -> Vect n a -> Nat
|
14
|
+
hamming_distance s1 s2 = ?hamming_distance_rhs
|
15
|
+
|
16
|
+
export
|
17
|
+
version : String
|
18
|
+
version = "1.0.0"
|
@@ -1,66 +1,39 @@
|
|
1
1
|
module Test.Hamming
|
2
2
|
|
3
3
|
import Data.Vect
|
4
|
-
import
|
5
|
-
|
6
|
-
%access export
|
7
|
-
|
8
|
-
assertEq : Eq a => (given : a) -> (expected : a) -> IO ()
|
9
|
-
assertEq g e = putStrLn $ if g == e then "Test Passed" else "Test Failed"
|
10
|
-
|
11
|
-
testIdenticalStrands : IO ()
|
12
|
-
testIdenticalStrands = assertEq (hamming_distance [A] [A]) 0
|
13
|
-
|
14
|
-
testLongIdenticalStrands : IO ()
|
15
|
-
testLongIdenticalStrands = assertEq (hamming_distance [G,G,A,C,T,G,A] [G,G,A,C,T,G,A]) 0
|
16
|
-
|
17
|
-
testDifferentSingleNucleotideStrands : IO ()
|
18
|
-
testDifferentSingleNucleotideStrands = assertEq (hamming_distance [A] [G]) 1
|
19
|
-
|
20
|
-
testMaximumDistanceInSmallNucleotideStrands : IO ()
|
21
|
-
testMaximumDistanceInSmallNucleotideStrands = assertEq (hamming_distance [A,G] [C,T]) 2
|
22
|
-
|
23
|
-
testSmallDifferenceInSmallNucleotideStrands : IO ()
|
24
|
-
testSmallDifferenceInSmallNucleotideStrands = assertEq (hamming_distance [A,T] [C,T]) 1
|
4
|
+
import Test.Assertions
|
5
|
+
import System
|
25
6
|
|
26
|
-
|
27
|
-
testSmallDistance = assertEq (hamming_distance [G,G,A,C,G] [G,G,T,C,G]) 1
|
28
|
-
|
29
|
-
testSmallDistanceInLongStrands : IO ()
|
30
|
-
testSmallDistanceInLongStrands = assertEq (hamming_distance [A,C,C,A,G,G,G] [A,C,T,A,T,G,G]) 2
|
31
|
-
|
32
|
-
testNonUniqueCharacterInFirstStrand : IO ()
|
33
|
-
testNonUniqueCharacterInFirstStrand = assertEq (hamming_distance [A,G,A] [A,G,G]) 1
|
34
|
-
|
35
|
-
testNonUniqueCharacterInSecondStrand : IO ()
|
36
|
-
testNonUniqueCharacterInSecondStrand = assertEq (hamming_distance [A,G,G] [A,G,A]) 1
|
37
|
-
|
38
|
-
testSameNucleotidesInDifferentPositions : IO ()
|
39
|
-
testSameNucleotidesInDifferentPositions = assertEq (hamming_distance [T,A,G] [G,A,T]) 2
|
40
|
-
|
41
|
-
testLargeDistance : IO ()
|
42
|
-
testLargeDistance = assertEq (hamming_distance [G,A,T,A,C,A] [G,C,A,T,A,A]) 4
|
43
|
-
|
44
|
-
testLargeDistanceInOffByOneStrand : IO ()
|
45
|
-
testLargeDistanceInOffByOneStrand = assertEq (hamming_distance [G,G,A,C,G,G,A,T,T,C,T,G] [A,G,G,A,C,G,G,A,T,T,C,T]) 9
|
7
|
+
import Hamming
|
46
8
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
9
|
+
collect : {default 0 acc : Nat} -> (List (IO Bool)) -> IO Nat
|
10
|
+
collect {acc} [] = pure acc
|
11
|
+
collect {acc} (test :: tests) = do
|
12
|
+
bool <- test
|
13
|
+
case bool of
|
14
|
+
True => collect {acc=acc} tests
|
15
|
+
False => collect {acc=S acc} tests
|
51
16
|
|
17
|
+
export
|
52
18
|
runTests : IO ()
|
53
19
|
runTests = do
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
20
|
+
let empty = the (Vect _ Nucleotide) []
|
21
|
+
count <- collect
|
22
|
+
[ assertEquals (hamming_distance [A] [A]) 0
|
23
|
+
, assertEquals (hamming_distance [G,G,A,C,T,G,A] [G,G,A,C,T,G,A]) 0
|
24
|
+
, assertEquals (hamming_distance [A] [G]) 1
|
25
|
+
, assertEquals (hamming_distance [A,G] [C,T]) 2
|
26
|
+
, assertEquals (hamming_distance [A,T] [C,T]) 1
|
27
|
+
, assertEquals (hamming_distance [G,G,A,C,G] [G,G,T,C,G]) 1
|
28
|
+
, assertEquals (hamming_distance [A,C,C,A,G,G,G] [A,C,T,A,T,G,G]) 2
|
29
|
+
, assertEquals (hamming_distance [A,G,A] [A,G,G]) 1
|
30
|
+
, assertEquals (hamming_distance [A,G,G] [A,G,A]) 1
|
31
|
+
, assertEquals (hamming_distance [T,A,G] [G,A,T]) 2
|
32
|
+
, assertEquals (hamming_distance [G,A,T,A,C,A] [G,C,A,T,A,A]) 4
|
33
|
+
, assertEquals (hamming_distance [G,G,A,C,G,G,A,T,T,C,T,G] [A,G,G,A,C,G,G,A,T,T,C,T]) 9
|
34
|
+
, assertEquals (hamming_distance empty empty) 0
|
35
|
+
, assertEquals version "1.0.0"
|
36
|
+
]
|
37
|
+
case count of
|
38
|
+
Z => exitSuccess
|
39
|
+
_ => exitFailure
|
@@ -1,25 +1,25 @@
|
|
1
1
|
module Test.HelloWorld
|
2
2
|
|
3
|
-
import
|
4
|
-
|
5
|
-
%access export
|
6
|
-
|
7
|
-
assertEq : Eq a => (given : a) -> (expected : a) -> IO ()
|
8
|
-
assertEq g e = putStrLn $ if g == e
|
9
|
-
then "Test Passed"
|
10
|
-
else "Test Failed"
|
3
|
+
import Test.Assertions
|
4
|
+
import System
|
11
5
|
|
12
|
-
|
13
|
-
testNothing = assertEq (greet Nothing) "Hello, World!"
|
14
|
-
|
15
|
-
testJustAlice : IO ()
|
16
|
-
testJustAlice = assertEq (greet (Just "Alice")) "Hello, Alice!"
|
6
|
+
import HelloWorld
|
17
7
|
|
18
|
-
|
19
|
-
|
8
|
+
collect : {default 0 acc : Nat} -> (List (IO Bool)) -> IO Nat
|
9
|
+
collect {acc} [] = pure acc
|
10
|
+
collect {acc} (test :: tests) = do
|
11
|
+
bool <- test
|
12
|
+
case bool of
|
13
|
+
True => collect {acc=acc} tests
|
14
|
+
False => collect {acc=S acc} tests
|
20
15
|
|
16
|
+
export
|
21
17
|
runTests : IO ()
|
22
18
|
runTests = do
|
23
|
-
|
24
|
-
|
25
|
-
|
19
|
+
count <- collect
|
20
|
+
[ assertEquals hello "Hello, World!"
|
21
|
+
, assertEquals version "1.0.0"
|
22
|
+
]
|
23
|
+
case count of
|
24
|
+
Z => exitSuccess
|
25
|
+
_ => exitFailure
|
@@ -1,37 +1,28 @@
|
|
1
1
|
module Test.Leap
|
2
2
|
|
3
|
-
import
|
4
|
-
|
5
|
-
%access export
|
6
|
-
|
7
|
-
assertBool : Bool -> Bool -> IO ()
|
8
|
-
assertBool expected given = putStrLn $ if given == expected then "Test Passed" else "Test Failed"
|
9
|
-
|
10
|
-
assertTrue : Bool -> IO ()
|
11
|
-
assertTrue = assertBool True
|
3
|
+
import Test.Assertions
|
4
|
+
import System
|
12
5
|
|
13
|
-
|
14
|
-
assertFalse = assertBool False
|
15
|
-
|
16
|
-
-- year not divisible by 4: common year
|
17
|
-
test2015 : IO ()
|
18
|
-
test2015 = assertFalse (isLeap 2015)
|
19
|
-
|
20
|
-
-- year divisible by 4, not divisible by 100: leap year
|
21
|
-
test2016 : IO ()
|
22
|
-
test2016 = assertTrue (isLeap 2016)
|
23
|
-
|
24
|
-
-- year divisible by 100, not divisible by 400: common year
|
25
|
-
test2100 : IO ()
|
26
|
-
test2100 = assertFalse (isLeap 2100)
|
6
|
+
import Leap
|
27
7
|
|
28
|
-
|
29
|
-
|
30
|
-
|
8
|
+
collect : {default 0 acc : Nat} -> (List (IO Bool)) -> IO Nat
|
9
|
+
collect {acc} [] = pure acc
|
10
|
+
collect {acc} (test :: tests) = do
|
11
|
+
bool <- test
|
12
|
+
case bool of
|
13
|
+
True => collect {acc=acc} tests
|
14
|
+
False => collect {acc=S acc} tests
|
31
15
|
|
16
|
+
export
|
32
17
|
runTests : IO ()
|
33
18
|
runTests = do
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
19
|
+
count <- collect
|
20
|
+
[ assertFalse (isLeap 2015)
|
21
|
+
, assertTrue (isLeap 2016)
|
22
|
+
, assertFalse (isLeap 2100)
|
23
|
+
, assertTrue (isLeap 2000)
|
24
|
+
, assertEquals version "1.0.0"
|
25
|
+
]
|
26
|
+
case count of
|
27
|
+
Z => exitSuccess
|
28
|
+
_ => exitFailure
|
@@ -0,0 +1,23 @@
|
|
1
|
+
idris ?= idris
|
2
|
+
pkg := RnaTranscription
|
3
|
+
|
4
|
+
.PHONY: build clean clobber install rebuild test
|
5
|
+
|
6
|
+
all: test
|
7
|
+
|
8
|
+
build:
|
9
|
+
@ ${idris} --build ${pkg}.ipkg
|
10
|
+
|
11
|
+
clean:
|
12
|
+
@ ${idris} --clean ${pkg}.ipkg
|
13
|
+
|
14
|
+
clobber: clean
|
15
|
+
@ find . -name '*.ibc' -delete
|
16
|
+
|
17
|
+
install:
|
18
|
+
@ ${idris} --install ${pkg}.ipkg
|
19
|
+
|
20
|
+
rebuild: clean build
|
21
|
+
|
22
|
+
test:
|
23
|
+
@ ${idris} --testpkg ${pkg}.ipkg
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# Rna Transcription
|
2
|
+
|
3
|
+
Given a DNA strand, return its RNA complement (per RNA transcription).
|
4
|
+
|
5
|
+
Both DNA and RNA strands are a sequence of nucleotides.
|
6
|
+
|
7
|
+
The four nucleotides found in DNA are adenine (**A**), cytosine (**C**),
|
8
|
+
guanine (**G**) and thymine (**T**).
|
9
|
+
|
10
|
+
The four nucleotides found in RNA are adenine (**A**), cytosine (**C**),
|
11
|
+
guanine (**G**) and uracil (**U**).
|
12
|
+
|
13
|
+
Given a DNA strand, its transcribed RNA strand is formed by replacing
|
14
|
+
each nucleotide with its complement:
|
15
|
+
|
16
|
+
* `G` -> `C`
|
17
|
+
* `C` -> `G`
|
18
|
+
* `T` -> `A`
|
19
|
+
* `A` -> `U`
|
20
|
+
|
21
|
+
## Source
|
22
|
+
|
23
|
+
Rosalind [http://rosalind.info/problems/rna](http://rosalind.info/problems/rna)
|
24
|
+
|
25
|
+
## Submitting Incomplete Solutions
|
26
|
+
|
27
|
+
It's possible to submit an incomplete solution so you can see how others have completed the exercise.
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module RnaTranscription
|
2
|
+
|
3
|
+
import Data.Vect
|
4
|
+
|
5
|
+
%access export
|
6
|
+
%default total
|
7
|
+
|
8
|
+
namespace DnaStrand
|
9
|
+
public export
|
10
|
+
data DnaStrand
|
11
|
+
|
12
|
+
namespace RnaStrand
|
13
|
+
public export
|
14
|
+
data RnaStrand
|
15
|
+
|
16
|
+
toRna : Vect n DnaStrand -> Vect n RnaStrand
|
17
|
+
toRna = ?toRna_rhs
|