trackler 2.0.8.3 → 2.0.8.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f0c444d7b94d362ffd61d031a2c19aa0648aec67
4
- data.tar.gz: b89e89a7208130f5c3609cdfc7d489b9049ceb7e
3
+ metadata.gz: 057df974f1cb8cbe89eb10ab81dc89e9eac54905
4
+ data.tar.gz: cfef594bcbd45d09c177baec8bfaa6faf2cfa83d
5
5
  SHA512:
6
- metadata.gz: 04579958808938ab72cb8921a7c432c814a219a283b375a732da663b2060cf688640a7cd7ca0f185af4d8c5d2874fcd88c51be3ec0db0f39dde08c46f8203e4a
7
- data.tar.gz: 4b4b7d1cde0197fba10b59031fb9355ee2fa4e4a36f5a131b198df6129516e7891ef05f10f3d4117b909a71d6c3ef27b5b91b1bed520d4288159c294427779cb
6
+ metadata.gz: 43581a5b366c4c07936515ed2ce716d4c6e358dc96f1eafb5b26bc89a75d5624d3e69e864a38497e83d88719bf881536cd42b8f4c07320cdb754285c4895df9b
7
+ data.tar.gz: 9177f3b84ea412493fe66da72d52b774c474a738091441293a843321fa7316c67160735ec893719a28127995c0b544e46be5dec38407f8cc67a14f3cd0c5fdae
@@ -1,3 +1,3 @@
1
1
  module Trackler
2
- VERSION = "2.0.8.3"
2
+ VERSION = "2.0.8.4"
3
3
  end
@@ -126,9 +126,12 @@
126
126
  ]
127
127
  },
128
128
  {
129
- "difficulty": 1,
129
+ "difficulty": 2,
130
130
  "slug": "difference-of-squares",
131
- "topics": []
131
+ "topics": [
132
+ "Algorithms",
133
+ "Mathematics"
134
+ ]
132
135
  },
133
136
  {
134
137
  "difficulty": 1,
@@ -1,5 +1,7 @@
1
1
  package strain
2
2
 
3
+ const testVersion = 1
4
+
3
5
  type Ints []int
4
6
 
5
7
  func (s Ints) Keep(f func(int) bool) (r Ints) {
@@ -19,6 +19,14 @@ import (
19
19
  "testing"
20
20
  )
21
21
 
22
+ const targetTestVersion = 1
23
+
24
+ func TestTestVersion(t *testing.T) {
25
+ if testVersion != targetTestVersion {
26
+ t.Fatalf("Found testVersion = %v, want %v", testVersion, targetTestVersion)
27
+ }
28
+ }
29
+
22
30
  func lt10(x int) bool { return x < 10 }
23
31
  func gt10(x int) bool { return x > 10 }
24
32
  func odd(x int) bool { return x&1 == 1 }
@@ -31,6 +31,14 @@
31
31
  "Booleans",
32
32
  "Arithmetic"
33
33
  ]
34
+ },
35
+ {
36
+ "slug": "hamming",
37
+ "difficulty": 2,
38
+ "topics": [
39
+ "Export Modifiers",
40
+ "Vectors"
41
+ ]
34
42
  }
35
43
  ]
36
44
  }
@@ -0,0 +1,5 @@
1
+ package hamming
2
+
3
+ sourcedir = src
4
+ modules = Hamming, Test.Hamming
5
+ tests = Test.Hamming.runTests
@@ -0,0 +1,23 @@
1
+ idris ?= idris
2
+ pkg := Hamming
3
+
4
+ .PHONY: build clean clobber install rebuild test
5
+
6
+ all: build
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,10 @@
1
+ module Hamming
2
+
3
+ import Data.Vect
4
+
5
+ -- Add the correct export modifier here...
6
+ data Nucleotide -- insert definition here
7
+
8
+ -- Add the correct export modifier here...
9
+ hamming_distance : Vect n Nucleotide -> Vect n Nucleotide -> Nat
10
+ hamming_distance s1 s2 = ?hamming_distance_rhs
@@ -0,0 +1,66 @@
1
+ module Test.Hamming
2
+
3
+ import Data.Vect
4
+ import Hamming
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
25
+
26
+ testSmallDistance : IO ()
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
46
+
47
+ testEmptyStrands : IO ()
48
+ testEmptyStrands =
49
+ let empty = the (Vect _ Nucleotide) [] in
50
+ assertEq (hamming_distance empty empty) 0
51
+
52
+ runTests : IO ()
53
+ runTests = do
54
+ testIdenticalStrands
55
+ testLongIdenticalStrands
56
+ testDifferentSingleNucleotideStrands
57
+ testMaximumDistanceInSmallNucleotideStrands
58
+ testSmallDifferenceInSmallNucleotideStrands
59
+ testSmallDistance
60
+ testSmallDistanceInLongStrands
61
+ testNonUniqueCharacterInFirstStrand
62
+ testNonUniqueCharacterInSecondStrand
63
+ testSameNucleotidesInDifferentPositions
64
+ testLargeDistance
65
+ testLargeDistanceInOffByOneStrand
66
+ testEmptyStrands
@@ -0,0 +1,19 @@
1
+ module Hamming
2
+
3
+ import Data.Vect
4
+
5
+ public export
6
+ data Nucleotide = A | C | G | T
7
+
8
+ public export
9
+ implementation Eq Nucleotide where
10
+ A == A = True
11
+ C == C = True
12
+ G == G = True
13
+ T == T = True
14
+ _ == _ = False
15
+
16
+ export
17
+ hamming_distance : Eq a => Vect n a -> Vect n a -> Nat
18
+ hamming_distance s1 s2 =
19
+ fst $ filter ((/=) 0) $ map (\(n1,n2) => if n1 == n2 then 0 else 1) $ zip s1 s2
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.8.3
4
+ version: 2.0.8.4
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-02-23 00:00:00.000000000 Z
11
+ date: 2017-02-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubyzip
@@ -3823,6 +3823,11 @@ files:
3823
3823
  - tracks/idris/docs/RESOURCES.md
3824
3824
  - tracks/idris/docs/TESTS.md
3825
3825
  - tracks/idris/exercises/.keep
3826
+ - tracks/idris/exercises/hamming/Hamming.ipkg
3827
+ - tracks/idris/exercises/hamming/Makefile
3828
+ - tracks/idris/exercises/hamming/src/Hamming.idr
3829
+ - tracks/idris/exercises/hamming/src/Test/Hamming.idr
3830
+ - tracks/idris/exercises/hamming/src/example.idr
3826
3831
  - tracks/idris/exercises/hello-world/HelloWorld.ipkg
3827
3832
  - tracks/idris/exercises/hello-world/Makefile
3828
3833
  - tracks/idris/exercises/hello-world/src/Test/HelloWorld.idr