trackler 2.2.1.138 → 2.2.1.139
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/crypto-square/description.md +23 -19
- data/problem-specifications/exercises/yacht/canonical-data.json +10 -1
- data/tracks/clojure/exercises/gigasecond/src/gigasecond.clj +5 -0
- data/tracks/clojure/exercises/grade-school/src/grade_school.clj +13 -0
- data/tracks/clojure/exercises/grains/src/grains.clj +9 -0
- data/tracks/clojure/exercises/minesweeper/src/minesweeper.clj +5 -0
- data/tracks/fsharp/docs/GENERATORS.md +12 -14
- data/tracks/fsharp/exercises/bowling/BowlingTest.fs +15 -15
- data/tracks/fsharp/exercises/perfect-numbers/PerfectNumbersTest.fs +11 -11
- data/tracks/fsharp/exercises/rna-transcription/Example.fs +7 -15
- data/tracks/fsharp/exercises/rna-transcription/RnaTranscription.fs +1 -1
- data/tracks/fsharp/exercises/rna-transcription/RnaTranscriptionTest.fs +5 -5
- data/tracks/fsharp/exercises/robot-simulator/RobotSimulatorTest.fs +34 -34
- data/tracks/fsharp/exercises/sublist/Example.fs +1 -1
- data/tracks/fsharp/exercises/sublist/Sublist.fs +1 -1
- data/tracks/fsharp/exercises/sublist/SublistTest.fs +17 -17
- data/tracks/fsharp/exercises/word-search/WordSearchTest.fs +56 -57
- data/tracks/fsharp/generators/CanonicalData.fs +14 -15
- data/tracks/fsharp/generators/Common.fs +4 -84
- data/tracks/fsharp/generators/Conversion.fs +75 -0
- data/tracks/fsharp/generators/Exercise.fs +15 -11
- data/tracks/fsharp/generators/Generators.fs +294 -468
- data/tracks/fsharp/generators/Generators.fsproj +2 -1
- data/tracks/fsharp/generators/Rendering.fs +169 -61
- data/tracks/fsharp/generators/Templates.fs +64 -0
- data/tracks/fsharp/generators/Track.fs +3 -3
- data/tracks/idris/exercises/accumulate/src/Example.idr +1 -1
- data/tracks/idris/exercises/accumulate/src/Test/Accumulate.idr +2 -2
- data/tracks/java/exercises/rna-transcription/.meta/hints.md +2 -0
- data/tracks/java/exercises/rna-transcription/README.md +6 -0
- data/tracks/nim/.gitignore +1 -0
- data/tracks/nim/config.json +38 -0
- data/tracks/nim/config/maintainers.json +10 -0
- data/tracks/nim/docs/ABOUT.md +7 -0
- data/tracks/nim/exercises/bob/README.md +2 -0
- data/tracks/nim/exercises/bob/bob_test.nim +31 -13
- data/tracks/nim/exercises/bob/example.nim +2 -2
- data/tracks/nim/exercises/gigasecond/README.md +22 -0
- data/tracks/nim/exercises/gigasecond/example.nim +4 -0
- data/tracks/nim/exercises/gigasecond/gigasecond_test.nim +32 -0
- data/tracks/nim/exercises/isogram/README.md +20 -0
- data/tracks/nim/exercises/isogram/example.nim +6 -0
- data/tracks/nim/exercises/isogram/isogram_test.nim +32 -0
- data/tracks/nim/exercises/space-age/README.md +24 -0
- data/tracks/nim/exercises/space-age/example.nim +17 -0
- data/tracks/nim/exercises/space-age/space_age_test.nim +29 -0
- data/tracks/nim/exercises/triangle/example.nim +22 -22
- data/tracks/nim/exercises/triangle/triangle_test.nim +32 -44
- metadata +19 -3
- data/tracks/fsharp/generators/Formatting.fs +0 -189
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.139
|
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-
|
11
|
+
date: 2018-05-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubyzip
|
@@ -1667,14 +1667,17 @@ files:
|
|
1667
1667
|
- tracks/clojure/exercises/gigasecond/README.md
|
1668
1668
|
- tracks/clojure/exercises/gigasecond/project.clj
|
1669
1669
|
- tracks/clojure/exercises/gigasecond/src/example.clj
|
1670
|
+
- tracks/clojure/exercises/gigasecond/src/gigasecond.clj
|
1670
1671
|
- tracks/clojure/exercises/gigasecond/test/gigasecond_test.clj
|
1671
1672
|
- tracks/clojure/exercises/grade-school/README.md
|
1672
1673
|
- tracks/clojure/exercises/grade-school/project.clj
|
1673
1674
|
- tracks/clojure/exercises/grade-school/src/example.clj
|
1675
|
+
- tracks/clojure/exercises/grade-school/src/grade_school.clj
|
1674
1676
|
- tracks/clojure/exercises/grade-school/test/grade_school_test.clj
|
1675
1677
|
- tracks/clojure/exercises/grains/README.md
|
1676
1678
|
- tracks/clojure/exercises/grains/project.clj
|
1677
1679
|
- tracks/clojure/exercises/grains/src/example.clj
|
1680
|
+
- tracks/clojure/exercises/grains/src/grains.clj
|
1678
1681
|
- tracks/clojure/exercises/grains/test/grains_test.clj
|
1679
1682
|
- tracks/clojure/exercises/hamming/README.md
|
1680
1683
|
- tracks/clojure/exercises/hamming/project.clj
|
@@ -1724,6 +1727,7 @@ files:
|
|
1724
1727
|
- tracks/clojure/exercises/minesweeper/README.md
|
1725
1728
|
- tracks/clojure/exercises/minesweeper/project.clj
|
1726
1729
|
- tracks/clojure/exercises/minesweeper/src/example.clj
|
1730
|
+
- tracks/clojure/exercises/minesweeper/src/minesweeper.clj
|
1727
1731
|
- tracks/clojure/exercises/minesweeper/test/minesweeper_test.clj
|
1728
1732
|
- tracks/clojure/exercises/nth-prime/README.md
|
1729
1733
|
- tracks/clojure/exercises/nth-prime/project.clj
|
@@ -5958,8 +5962,8 @@ files:
|
|
5958
5962
|
- tracks/fsharp/exercises/zipper/ZipperTest.fs
|
5959
5963
|
- tracks/fsharp/generators/CanonicalData.fs
|
5960
5964
|
- tracks/fsharp/generators/Common.fs
|
5965
|
+
- tracks/fsharp/generators/Conversion.fs
|
5961
5966
|
- tracks/fsharp/generators/Exercise.fs
|
5962
|
-
- tracks/fsharp/generators/Formatting.fs
|
5963
5967
|
- tracks/fsharp/generators/Generators.fs
|
5964
5968
|
- tracks/fsharp/generators/Generators.fsproj
|
5965
5969
|
- tracks/fsharp/generators/Generators.fsproj.user
|
@@ -5968,6 +5972,7 @@ files:
|
|
5968
5972
|
- tracks/fsharp/generators/Program.fs
|
5969
5973
|
- tracks/fsharp/generators/Properties/launchSettings.json
|
5970
5974
|
- tracks/fsharp/generators/Rendering.fs
|
5975
|
+
- tracks/fsharp/generators/Templates.fs
|
5971
5976
|
- tracks/fsharp/generators/Templates/Generators/_GrepSetup.liquid
|
5972
5977
|
- tracks/fsharp/generators/Templates/_AssertEmpty.liquid
|
5973
5978
|
- tracks/fsharp/generators/Templates/_AssertEqual.liquid
|
@@ -8001,6 +8006,7 @@ files:
|
|
8001
8006
|
- tracks/java/exercises/reverse-string/build.gradle
|
8002
8007
|
- tracks/java/exercises/reverse-string/src/main/java/ReverseString.java
|
8003
8008
|
- tracks/java/exercises/reverse-string/src/test/java/ReverseStringTest.java
|
8009
|
+
- tracks/java/exercises/rna-transcription/.meta/hints.md
|
8004
8010
|
- tracks/java/exercises/rna-transcription/.meta/src/reference/java/RnaTranscription.java
|
8005
8011
|
- tracks/java/exercises/rna-transcription/.meta/version
|
8006
8012
|
- tracks/java/exercises/rna-transcription/README.md
|
@@ -9799,6 +9805,7 @@ files:
|
|
9799
9805
|
- tracks/nim/config.json
|
9800
9806
|
- tracks/nim/config/exercise_readme.go.tmpl
|
9801
9807
|
- tracks/nim/config/maintainers.json
|
9808
|
+
- tracks/nim/docs/ABOUT.md
|
9802
9809
|
- tracks/nim/docs/INSTALLATION.md
|
9803
9810
|
- tracks/nim/docs/RESOURCES.md
|
9804
9811
|
- tracks/nim/docs/SNIPPET.txt
|
@@ -9818,12 +9825,18 @@ files:
|
|
9818
9825
|
- tracks/nim/exercises/difference-of-squares/README.md
|
9819
9826
|
- tracks/nim/exercises/difference-of-squares/difference_of_squares_test.nim
|
9820
9827
|
- tracks/nim/exercises/difference-of-squares/example.nim
|
9828
|
+
- tracks/nim/exercises/gigasecond/README.md
|
9829
|
+
- tracks/nim/exercises/gigasecond/example.nim
|
9830
|
+
- tracks/nim/exercises/gigasecond/gigasecond_test.nim
|
9821
9831
|
- tracks/nim/exercises/hamming/README.md
|
9822
9832
|
- tracks/nim/exercises/hamming/example.nim
|
9823
9833
|
- tracks/nim/exercises/hamming/hamming_test.nim
|
9824
9834
|
- tracks/nim/exercises/hello-world/README.md
|
9825
9835
|
- tracks/nim/exercises/hello-world/example.nim
|
9826
9836
|
- tracks/nim/exercises/hello-world/helloworld_test.nim
|
9837
|
+
- tracks/nim/exercises/isogram/README.md
|
9838
|
+
- tracks/nim/exercises/isogram/example.nim
|
9839
|
+
- tracks/nim/exercises/isogram/isogram_test.nim
|
9827
9840
|
- tracks/nim/exercises/leap/README.md
|
9828
9841
|
- tracks/nim/exercises/leap/example.nim
|
9829
9842
|
- tracks/nim/exercises/leap/leap_test.nim
|
@@ -9851,6 +9864,9 @@ files:
|
|
9851
9864
|
- tracks/nim/exercises/scrabble-score/README.md
|
9852
9865
|
- tracks/nim/exercises/scrabble-score/example.nim
|
9853
9866
|
- tracks/nim/exercises/scrabble-score/scrabble_score_test.nim
|
9867
|
+
- tracks/nim/exercises/space-age/README.md
|
9868
|
+
- tracks/nim/exercises/space-age/example.nim
|
9869
|
+
- tracks/nim/exercises/space-age/space_age_test.nim
|
9854
9870
|
- tracks/nim/exercises/triangle/README.md
|
9855
9871
|
- tracks/nim/exercises/triangle/example.nim
|
9856
9872
|
- tracks/nim/exercises/triangle/triangle_test.nim
|
@@ -1,189 +0,0 @@
|
|
1
|
-
module Generators.Formatting
|
2
|
-
|
3
|
-
open System
|
4
|
-
open System.Collections.Generic
|
5
|
-
open FSharp.Reflection
|
6
|
-
open Newtonsoft.Json.Linq
|
7
|
-
|
8
|
-
let indent level value =
|
9
|
-
let indentation = String.replicate level " "
|
10
|
-
sprintf "%s%s" indentation value
|
11
|
-
|
12
|
-
let parenthesize value = sprintf "(%s)" value
|
13
|
-
|
14
|
-
let parenthesizeOption value =
|
15
|
-
match value with
|
16
|
-
| "None" -> value
|
17
|
-
| _ -> parenthesize value
|
18
|
-
|
19
|
-
let backwardPipe value = sprintf "<| %s" value
|
20
|
-
|
21
|
-
let backwardPipeIf test value = if test value then backwardPipe value else value
|
22
|
-
|
23
|
-
let addTypeAnnotation typeAnnotation value = sprintf "%s: %s" value typeAnnotation
|
24
|
-
|
25
|
-
let escapeSpecialCharacters (str: string) =
|
26
|
-
str.Replace("\n", "\\n")
|
27
|
-
.Replace("\t", "\\t")
|
28
|
-
.Replace("\r", "\\r")
|
29
|
-
.Replace("\"", "\\\"")
|
30
|
-
|
31
|
-
let formatString str =
|
32
|
-
str
|
33
|
-
|> escapeSpecialCharacters
|
34
|
-
|> sprintf "\"%s\""
|
35
|
-
|
36
|
-
let formatBool b = if b then "true" else "false"
|
37
|
-
|
38
|
-
let formatDateTime (dateTime: DateTime) =
|
39
|
-
if dateTime.TimeOfDay = TimeSpan.Zero then
|
40
|
-
sprintf "DateTime(%d, %d, %d)" dateTime.Year dateTime.Month dateTime.Day
|
41
|
-
else
|
42
|
-
sprintf "DateTime(%d, %d, %d, %d, %d, %d)" dateTime.Year dateTime.Month dateTime.Day dateTime.Hour dateTime.Minute dateTime.Second
|
43
|
-
|
44
|
-
let formatTimeSpan (timeSpan: TimeSpan) =
|
45
|
-
sprintf "TimeSpan(%d, %d, %d)" timeSpan.Hours timeSpan.Minutes timeSpan.Seconds
|
46
|
-
|
47
|
-
let isInt (jToken: JToken) = jToken.Value<int64>() <= int64 Int32.MaxValue
|
48
|
-
|
49
|
-
let rec normalizeJArray (jArray: JArray): obj list =
|
50
|
-
let toBoxedList seq =
|
51
|
-
seq
|
52
|
-
|> Seq.map box
|
53
|
-
|> List.ofSeq
|
54
|
-
|
55
|
-
if jArray.Count = 0 then
|
56
|
-
[]
|
57
|
-
else if jArray.Children() |> Seq.forall (fun x -> x.Type = JTokenType.Integer && isInt x) then
|
58
|
-
jArray.Values<int>() |> toBoxedList
|
59
|
-
else if jArray.Children() |> Seq.forall (fun x -> x.Type = JTokenType.Integer) then
|
60
|
-
jArray.Values<int64>() |> toBoxedList
|
61
|
-
else if jArray.Children() |> Seq.forall (fun x -> x.Type = JTokenType.Float) then
|
62
|
-
jArray.Values<float>() |> toBoxedList
|
63
|
-
else if jArray.Children() |> Seq.forall (fun x -> x.Type = JTokenType.Boolean) then
|
64
|
-
jArray.Values<bool>() |> toBoxedList
|
65
|
-
else if jArray.Children() |> Seq.forall (fun x -> x.Type = JTokenType.String) then
|
66
|
-
jArray.Values<string>() |> toBoxedList
|
67
|
-
else if jArray.Children() |> Seq.forall (fun x -> x.Type = JTokenType.Date) then
|
68
|
-
jArray.Values<DateTime>() |> toBoxedList
|
69
|
-
else if jArray.Children() |> Seq.forall (fun x -> x.Type = JTokenType.TimeSpan) then
|
70
|
-
jArray.Values<TimeSpan>() |> toBoxedList
|
71
|
-
else if jArray.Children() |> Seq.forall (fun x -> x.Type = JTokenType.Object) then
|
72
|
-
jArray.Children() |> Seq.map (fun jObject -> jObject.ToObject<Dictionary<string, obj>>()) |> toBoxedList
|
73
|
-
else if jArray.Children() |> Seq.forall (fun x -> x.Type = JTokenType.Array) then
|
74
|
-
jArray.Values<JArray>() |> Seq.map normalizeJArray |> toBoxedList
|
75
|
-
else
|
76
|
-
jArray.Values<obj>() |> toBoxedList
|
77
|
-
|
78
|
-
let formatToken (jToken: JToken) =
|
79
|
-
match jToken.Type with
|
80
|
-
| JTokenType.Integer when isInt jToken -> jToken.ToObject<int>() |> string
|
81
|
-
| JTokenType.Integer -> jToken.ToObject<int64>() |> string
|
82
|
-
| JTokenType.Float -> jToken.ToObject<float>() |> string
|
83
|
-
| JTokenType.Boolean -> jToken.ToObject<bool>() |> formatBool
|
84
|
-
| JTokenType.String -> jToken.ToObject<string>() |> formatString
|
85
|
-
| JTokenType.Date -> jToken.ToObject<DateTime>() |> formatDateTime
|
86
|
-
| JTokenType.TimeSpan -> jToken.ToObject<TimeSpan>() |> formatTimeSpan
|
87
|
-
| _ -> string jToken
|
88
|
-
|
89
|
-
let formatJArray (jArray: JArray) =
|
90
|
-
jArray
|
91
|
-
|> normalizeJArray
|
92
|
-
|> sprintf "%A"
|
93
|
-
|
94
|
-
let formatTuple tuple = sprintf "%A" tuple
|
95
|
-
|
96
|
-
let formatRecord record = sprintf "%A" record
|
97
|
-
|
98
|
-
let formatOption option =
|
99
|
-
match option with
|
100
|
-
| None -> "None"
|
101
|
-
| Some x -> sprintf "Some %s" x
|
102
|
-
|
103
|
-
let formatResult result =
|
104
|
-
match result with
|
105
|
-
| Ok x -> sprintf "Ok %s" x
|
106
|
-
| Error y -> sprintf "Error %s" y
|
107
|
-
|
108
|
-
let rec formatValue (value: obj) =
|
109
|
-
match value with
|
110
|
-
| :? string as s ->
|
111
|
-
formatString s
|
112
|
-
| :? bool as b ->
|
113
|
-
formatBool b
|
114
|
-
| :? DateTime as dateTime ->
|
115
|
-
formatDateTime dateTime
|
116
|
-
| :? JArray as jArray ->
|
117
|
-
formatJArray jArray
|
118
|
-
| :? JToken as jToken ->
|
119
|
-
formatToken jToken
|
120
|
-
| :? Option<obj> as option ->
|
121
|
-
option |> Option.map formatValue |> formatOption
|
122
|
-
| :? Result<obj, obj> as result ->
|
123
|
-
result |> Result.map formatValue |> Result.mapError formatValue |> formatResult
|
124
|
-
| _ when FSharpType.IsTuple (value.GetType()) ->
|
125
|
-
formatTuple value
|
126
|
-
| _ when FSharpType.IsRecord (value.GetType()) ->
|
127
|
-
formatRecord value
|
128
|
-
| _ ->
|
129
|
-
string value
|
130
|
-
|
131
|
-
let private formatCollection formatString collection =
|
132
|
-
collection
|
133
|
-
|> String.concat "; "
|
134
|
-
|> sprintf formatString
|
135
|
-
|
136
|
-
let formatList sequence = formatCollection "[%s]" sequence
|
137
|
-
|
138
|
-
let formatArray sequence = formatCollection "[|%s|]" sequence
|
139
|
-
|
140
|
-
let formatSequence sequence = formatCollection "seq {%s}" sequence
|
141
|
-
|
142
|
-
let private formatMultiLineCollection (openPrefix, closePostfix) collection indentation =
|
143
|
-
match Seq.length collection with
|
144
|
-
| 0 ->
|
145
|
-
sprintf "%s%s" openPrefix closePostfix
|
146
|
-
| 1 ->
|
147
|
-
sprintf "%s%s%s" openPrefix (Seq.head collection) closePostfix
|
148
|
-
| length ->
|
149
|
-
let lineIndent = String(' ', String.length openPrefix)
|
150
|
-
|
151
|
-
let formatLine i line =
|
152
|
-
match i with
|
153
|
-
| 0 ->
|
154
|
-
sprintf "%s %s;" openPrefix line
|
155
|
-
| _ when i = length - 1 ->
|
156
|
-
sprintf "%s %s %s" lineIndent line closePostfix
|
157
|
-
| _ ->
|
158
|
-
sprintf "%s %s;" lineIndent line
|
159
|
-
|
160
|
-
collection
|
161
|
-
|> Seq.mapi formatLine
|
162
|
-
|> Seq.toList
|
163
|
-
|> List.map (indent indentation)
|
164
|
-
|> String.concat "\n"
|
165
|
-
|> sprintf "\n%s"
|
166
|
-
|
167
|
-
|
168
|
-
let formatMultiLineListWithIndentation indentation sequence = formatMultiLineCollection ("[", "]") sequence indentation
|
169
|
-
|
170
|
-
let formatMultiLineArrayWithIndentation indentation sequence = formatMultiLineCollection ("[|", "|]") sequence indentation
|
171
|
-
|
172
|
-
let formatMultiLineSequenceWithIndentation indentation sequence = formatMultiLineCollection ("seq {", "}") sequence indentation
|
173
|
-
|
174
|
-
let formatMultiLineList sequence = formatMultiLineListWithIndentation 2 sequence
|
175
|
-
|
176
|
-
let formatMultiLineArray sequence = formatMultiLineArrayWithIndentation 2 sequence
|
177
|
-
|
178
|
-
let formatMultiLineSequence sequence = formatMultiLineSequenceWithIndentation 2 sequence
|
179
|
-
|
180
|
-
let formatMultiLineString strings =
|
181
|
-
let length = Seq.length strings
|
182
|
-
let formatLine i line =
|
183
|
-
match i = length - 1 with
|
184
|
-
| true -> line
|
185
|
-
| false -> sprintf "%s +" line
|
186
|
-
|
187
|
-
strings
|
188
|
-
|> Seq.mapi formatLine
|
189
|
-
|> Seq.toList
|