diff --git a/kotlin/accumulate/README.md b/kotlin/accumulate/README.md new file mode 100644 index 0000000..a033af6 --- /dev/null +++ b/kotlin/accumulate/README.md @@ -0,0 +1,37 @@ +# Accumulate + +Implement the `accumulate` operation, which, given a collection and an +operation to perform on each element of the collection, returns a new +collection containing the result of applying that operation to each element of +the input collection. + +Given the collection of numbers: + +- 1, 2, 3, 4, 5 + +And the operation: + +- square a number (`x => x * x`) + +Your code should be able to produce the collection of squares: + +- 1, 4, 9, 16, 25 + +Check out the test suite to see the expected function signature. + +## Restrictions + +Keep your hands off that collect/map/fmap/whatchamacallit functionality +provided by your standard library! +Solve this one yourself using other basic tools instead. + +Lisp specific: it's perfectly fine to use `MAPCAR` or the equivalent, +as this is idiomatic Lisp, not a library function. + +## Source + +Conversation with James Edward Gray II [https://twitter.com/jeg2](https://twitter.com/jeg2) + +## Submitting Incomplete Solutions +It's possible to submit an incomplete solution so you can see how others have completed the exercise. + diff --git a/kotlin/accumulate/build.gradle b/kotlin/accumulate/build.gradle new file mode 100644 index 0000000..16c36c0 --- /dev/null +++ b/kotlin/accumulate/build.gradle @@ -0,0 +1,28 @@ +buildscript { + ext.kotlin_version = '1.1.1' + repositories { + mavenCentral() + } + dependencies { + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + } +} + +apply plugin: 'kotlin' + +repositories { + mavenCentral() +} + +dependencies { + compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" + + testCompile 'junit:junit:4.12' + testCompile "org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version" +} +test { + testLogging { + exceptionFormat = 'full' + events = ["passed", "failed", "skipped"] + } +} diff --git a/kotlin/accumulate/src/main/kotlin/.keep b/kotlin/accumulate/src/main/kotlin/.keep new file mode 100644 index 0000000..e69de29 diff --git a/kotlin/accumulate/src/test/kotlin/AccumulateTest.kt b/kotlin/accumulate/src/test/kotlin/AccumulateTest.kt new file mode 100644 index 0000000..665ea44 --- /dev/null +++ b/kotlin/accumulate/src/test/kotlin/AccumulateTest.kt @@ -0,0 +1,57 @@ +import org.junit.Test +import org.junit.Ignore +import kotlin.test.assertEquals + +class AccumulateTest { + + + @Test + fun emptyAccumulateProducesEmptyAccumulation() { + val input = listOf() + val expectedOutput = listOf() + assertEquals(expectedOutput, Accumulate.accumulate(input, { x -> x * x })) + } + + @Ignore + @Test + fun accumulateSquares() { + val input = listOf(1, 2, 3) + val expectedOutput = listOf(1, 4, 9) + assertEquals(expectedOutput, Accumulate.accumulate(input, { x -> x * x })) + } + + @Ignore + @Test + fun accumulateUpperCases() { + val input = listOf("hello", "world") + val expectedOutput = listOf("HELLO", "WORLD") + assertEquals(expectedOutput, Accumulate.accumulate(input, { it.toUpperCase() })) + } + + @Ignore + @Test + fun accumulateReversedStrings() { + val input = "the quick brown fox etc".split(" ") + val expectedOutput = "eht kciuq nworb xof cte".split(" ") + assertEquals(expectedOutput, Accumulate.accumulate(input, { it.reversed() })) + } + + @Ignore + @Test + fun accumulateWithinAccumulate() { + val input1 = listOf("a", "b", "c") + val input2 = listOf("1", "2", "3") + val expectedOutput = listOf("a1 a2 a3", "b1 b2 b3", "c1 c2 c3") + assertEquals(expectedOutput, Accumulate.accumulate(input1, + { c -> Accumulate.accumulate(input2, { d -> c + d }).joinToString(" ") } + )) + } + + @Ignore + @Test + fun accumulateToDifferentType() { + val input = listOf(1, 2, 3) + val expectedOutput = listOf("1", "2", "3") + assertEquals(expectedOutput, Accumulate.accumulate(input, { it.toString() })) + } +} diff --git a/kotlin/etl/.gradle/3.5/file-changes/last-build.bin b/kotlin/etl/.gradle/3.5/file-changes/last-build.bin new file mode 100644 index 0000000..f76dd23 Binary files /dev/null and b/kotlin/etl/.gradle/3.5/file-changes/last-build.bin differ diff --git a/kotlin/etl/.gradle/3.5/taskHistory/taskHistory.lock b/kotlin/etl/.gradle/3.5/taskHistory/taskHistory.lock new file mode 100644 index 0000000..32c021b Binary files /dev/null and b/kotlin/etl/.gradle/3.5/taskHistory/taskHistory.lock differ diff --git a/kotlin/etl/.gradle/buildOutputCleanup/built.bin b/kotlin/etl/.gradle/buildOutputCleanup/built.bin new file mode 100644 index 0000000..e69de29 diff --git a/kotlin/etl/.gradle/buildOutputCleanup/cache.properties b/kotlin/etl/.gradle/buildOutputCleanup/cache.properties new file mode 100644 index 0000000..fbca5ab --- /dev/null +++ b/kotlin/etl/.gradle/buildOutputCleanup/cache.properties @@ -0,0 +1,2 @@ +#Fri Jun 02 17:32:18 EDT 2017 +gradle.version=3.5 diff --git a/kotlin/etl/.gradle/buildOutputCleanup/cache.properties.lock b/kotlin/etl/.gradle/buildOutputCleanup/cache.properties.lock new file mode 100644 index 0000000..40fdece --- /dev/null +++ b/kotlin/etl/.gradle/buildOutputCleanup/cache.properties.lock @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/kotlin/etl/.idea/compiler.xml b/kotlin/etl/.idea/compiler.xml new file mode 100644 index 0000000..0fcf8d4 --- /dev/null +++ b/kotlin/etl/.idea/compiler.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/kotlin/etl/.idea/gradle.xml b/kotlin/etl/.idea/gradle.xml new file mode 100644 index 0000000..20d2df6 --- /dev/null +++ b/kotlin/etl/.idea/gradle.xml @@ -0,0 +1,19 @@ + + + + + + \ No newline at end of file diff --git a/kotlin/etl/.idea/libraries/Gradle__junit_junit_4_12.xml b/kotlin/etl/.idea/libraries/Gradle__junit_junit_4_12.xml new file mode 100644 index 0000000..04c10dd --- /dev/null +++ b/kotlin/etl/.idea/libraries/Gradle__junit_junit_4_12.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/kotlin/etl/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml b/kotlin/etl/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml new file mode 100644 index 0000000..8262f72 --- /dev/null +++ b/kotlin/etl/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/kotlin/etl/.idea/libraries/Gradle__org_jetbrains_annotations_13_0.xml b/kotlin/etl/.idea/libraries/Gradle__org_jetbrains_annotations_13_0.xml new file mode 100644 index 0000000..4f32fde --- /dev/null +++ b/kotlin/etl/.idea/libraries/Gradle__org_jetbrains_annotations_13_0.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/kotlin/etl/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_1_1.xml b/kotlin/etl/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_1_1.xml new file mode 100644 index 0000000..7b6f562 --- /dev/null +++ b/kotlin/etl/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_1_1.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/kotlin/etl/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_test_1_1_1.xml b/kotlin/etl/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_test_1_1_1.xml new file mode 100644 index 0000000..1720158 --- /dev/null +++ b/kotlin/etl/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_test_1_1_1.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/kotlin/etl/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_test_junit_1_1_1.xml b/kotlin/etl/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_test_junit_1_1_1.xml new file mode 100644 index 0000000..21c5d19 --- /dev/null +++ b/kotlin/etl/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_test_junit_1_1_1.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/kotlin/etl/.idea/misc.xml b/kotlin/etl/.idea/misc.xml new file mode 100644 index 0000000..84da703 --- /dev/null +++ b/kotlin/etl/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/kotlin/etl/.idea/modules.xml b/kotlin/etl/.idea/modules.xml new file mode 100644 index 0000000..75bafc3 --- /dev/null +++ b/kotlin/etl/.idea/modules.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/kotlin/etl/.idea/modules/etl_main.iml b/kotlin/etl/.idea/modules/etl_main.iml new file mode 100644 index 0000000..e7436c0 --- /dev/null +++ b/kotlin/etl/.idea/modules/etl_main.iml @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/kotlin/etl/.idea/modules/etl_test.iml b/kotlin/etl/.idea/modules/etl_test.iml new file mode 100644 index 0000000..b158ff6 --- /dev/null +++ b/kotlin/etl/.idea/modules/etl_test.iml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/kotlin/etl/.idea/workspace.xml b/kotlin/etl/.idea/workspace.xml new file mode 100644 index 0000000..8e81173 --- /dev/null +++ b/kotlin/etl/.idea/workspace.xml @@ -0,0 +1,867 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1496439132230 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/kotlin/etl/README.md b/kotlin/etl/README.md new file mode 100644 index 0000000..683bbcd --- /dev/null +++ b/kotlin/etl/README.md @@ -0,0 +1,53 @@ +# Etl + +We are going to do the `Transform` step of an Extract-Transform-Load. + +### ETL +Extract-Transform-Load (ETL) is a fancy way of saying, "We have some crufty, legacy data over in this system, and now we need it in this shiny new system over here, so +we're going to migrate this." + +(Typically, this is followed by, "We're only going to need to run this +once." That's then typically followed by much forehead slapping and +moaning about how stupid we could possibly be.) + +### The goal +We're going to extract some scrabble scores from a legacy system. + +The old system stored a list of letters per score: + +- 1 point: "A", "E", "I", "O", "U", "L", "N", "R", "S", "T", +- 2 points: "D", "G", +- 3 points: "B", "C", "M", "P", +- 4 points: "F", "H", "V", "W", "Y", +- 5 points: "K", +- 8 points: "J", "X", +- 10 points: "Q", "Z", + +The shiny new scrabble system instead stores the score per letter, which +makes it much faster and easier to calculate the score for a word. It +also stores the letters in lower-case regardless of the case of the +input letters: + +- "a" is worth 1 point. +- "b" is worth 3 points. +- "c" is worth 3 points. +- "d" is worth 2 points. +- Etc. + +Your mission, should you choose to accept it, is to transform the legacy data +format to the shiny new format. + +### Notes + +A final note about scoring, Scrabble is played around the world in a +variety of languages, each with its own unique scoring table. For +example, an "E" is scored at 2 in the Māori-language version of the +game while being scored at 4 in the Hawaiian-language version. + +## Source + +The Jumpstart Lab team [http://jumpstartlab.com](http://jumpstartlab.com) + +## Submitting Incomplete Solutions +It's possible to submit an incomplete solution so you can see how others have completed the exercise. + diff --git a/kotlin/etl/build.gradle b/kotlin/etl/build.gradle new file mode 100644 index 0000000..16c36c0 --- /dev/null +++ b/kotlin/etl/build.gradle @@ -0,0 +1,28 @@ +buildscript { + ext.kotlin_version = '1.1.1' + repositories { + mavenCentral() + } + dependencies { + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + } +} + +apply plugin: 'kotlin' + +repositories { + mavenCentral() +} + +dependencies { + compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" + + testCompile 'junit:junit:4.12' + testCompile "org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version" +} +test { + testLogging { + exceptionFormat = 'full' + events = ["passed", "failed", "skipped"] + } +} diff --git a/kotlin/etl/build/classes/main/ETL.class b/kotlin/etl/build/classes/main/ETL.class new file mode 100644 index 0000000..1266ca3 Binary files /dev/null and b/kotlin/etl/build/classes/main/ETL.class differ diff --git a/kotlin/etl/build/classes/test/ETLTest.class b/kotlin/etl/build/classes/test/ETLTest.class new file mode 100644 index 0000000..d6c350b Binary files /dev/null and b/kotlin/etl/build/classes/test/ETLTest.class differ diff --git a/kotlin/etl/build/kotlin-build/caches/version.txt b/kotlin/etl/build/kotlin-build/caches/version.txt new file mode 100644 index 0000000..01aabac --- /dev/null +++ b/kotlin/etl/build/kotlin-build/caches/version.txt @@ -0,0 +1 @@ +11001 \ No newline at end of file diff --git a/kotlin/etl/etl.iml b/kotlin/etl/etl.iml new file mode 100644 index 0000000..1551dc7 --- /dev/null +++ b/kotlin/etl/etl.iml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/kotlin/etl/src/main/kotlin/.keep b/kotlin/etl/src/main/kotlin/.keep new file mode 100644 index 0000000..e69de29 diff --git a/kotlin/etl/src/main/kotlin/ETL.kt b/kotlin/etl/src/main/kotlin/ETL.kt new file mode 100644 index 0000000..92cfdc0 --- /dev/null +++ b/kotlin/etl/src/main/kotlin/ETL.kt @@ -0,0 +1,9 @@ +object ETL { + fun transform(inpMap: Map>) : Map { + var outMap: MutableMap = emptyMap().toMutableMap() + for ((value, chars) in inpMap){ + chars.map { outMap.put(it.toLowerCase(), value)} + } + return outMap + } +} \ No newline at end of file diff --git a/kotlin/etl/src/test/kotlin/ETLTest.kt b/kotlin/etl/src/test/kotlin/ETLTest.kt new file mode 100644 index 0000000..7036b7a --- /dev/null +++ b/kotlin/etl/src/test/kotlin/ETLTest.kt @@ -0,0 +1,54 @@ +import org.junit.Test +import org.junit.Ignore +import kotlin.test.assertEquals + +class ETLTest { + + + @Test + fun transformOneValue() { + val old = mapOf(1 to listOf('a')) + val expected = mapOf('a' to 1) + + assertEquals(expected, ETL.transform(old)) + } + + @Test + fun transformMoreValues() { + val old = mapOf(1 to listOf('A', 'E', 'I')) + val expected = mapOf('a' to 1, 'e' to 1, 'i' to 1) + + assertEquals(expected, ETL.transform(old)) + } + + @Test + fun moreKeys() { + val old = mapOf(1 to listOf('A', 'E', 'I'), 2 to listOf('D', 'G')) + val expected = mapOf('a' to 1, 'e' to 1, 'i' to 1, 'd' to 2, 'g' to 2) + + assertEquals(expected, ETL.transform(old)) + } + + @Test + fun fullDataset() { + val old = mapOf( + 1 to listOf('A', 'E', 'I', 'O', 'U', 'L', 'N', 'R', 'S', 'T'), + 2 to listOf('D', 'G'), + 3 to listOf('B', 'C', 'M', 'P'), + 4 to listOf('F', 'H', 'V', 'W', 'Y'), + 5 to listOf('K'), + 8 to listOf('J', 'X'), + 10 to listOf('Q', 'Z') + ) + val expected = mapOf( + 'a' to 1, 'b' to 3, 'c' to 3, 'd' to 2, 'e' to 1, + 'f' to 4, 'g' to 2, 'h' to 4, 'i' to 1, 'j' to 8, + 'k' to 5, 'l' to 1, 'm' to 3, 'n' to 1, 'o' to 1, + 'p' to 3, 'q' to 10, 'r' to 1, 's' to 1, 't' to 1, + 'u' to 1, 'v' to 4, 'w' to 4, 'x' to 8, 'y' to 4, + 'z' to 10 + ) + + assertEquals(expected, ETL.transform(old)) + } +} diff --git a/kotlin/gigasecond/.gradle/3.5/file-changes/last-build.bin b/kotlin/gigasecond/.gradle/3.5/file-changes/last-build.bin new file mode 100644 index 0000000..f76dd23 Binary files /dev/null and b/kotlin/gigasecond/.gradle/3.5/file-changes/last-build.bin differ diff --git a/kotlin/gigasecond/.gradle/3.5/fileContent/fileContent.lock b/kotlin/gigasecond/.gradle/3.5/fileContent/fileContent.lock new file mode 100644 index 0000000..289d080 Binary files /dev/null and b/kotlin/gigasecond/.gradle/3.5/fileContent/fileContent.lock differ diff --git a/kotlin/gigasecond/.gradle/3.5/taskHistory/fileHashes.bin b/kotlin/gigasecond/.gradle/3.5/taskHistory/fileHashes.bin new file mode 100644 index 0000000..2f95261 Binary files /dev/null and b/kotlin/gigasecond/.gradle/3.5/taskHistory/fileHashes.bin differ diff --git a/kotlin/gigasecond/.gradle/3.5/taskHistory/fileSnapshots.bin b/kotlin/gigasecond/.gradle/3.5/taskHistory/fileSnapshots.bin new file mode 100644 index 0000000..37e6dd4 Binary files /dev/null and b/kotlin/gigasecond/.gradle/3.5/taskHistory/fileSnapshots.bin differ diff --git a/kotlin/gigasecond/.gradle/3.5/taskHistory/taskHistory.bin b/kotlin/gigasecond/.gradle/3.5/taskHistory/taskHistory.bin new file mode 100644 index 0000000..879a9e3 Binary files /dev/null and b/kotlin/gigasecond/.gradle/3.5/taskHistory/taskHistory.bin differ diff --git a/kotlin/gigasecond/.gradle/3.5/taskHistory/taskHistory.lock b/kotlin/gigasecond/.gradle/3.5/taskHistory/taskHistory.lock new file mode 100644 index 0000000..fc500e3 Binary files /dev/null and b/kotlin/gigasecond/.gradle/3.5/taskHistory/taskHistory.lock differ diff --git a/kotlin/gigasecond/.gradle/buildOutputCleanup/built.bin b/kotlin/gigasecond/.gradle/buildOutputCleanup/built.bin new file mode 100644 index 0000000..e69de29 diff --git a/kotlin/gigasecond/.gradle/buildOutputCleanup/cache.properties b/kotlin/gigasecond/.gradle/buildOutputCleanup/cache.properties new file mode 100644 index 0000000..2b17c65 --- /dev/null +++ b/kotlin/gigasecond/.gradle/buildOutputCleanup/cache.properties @@ -0,0 +1,2 @@ +#Fri Jun 02 16:10:02 EDT 2017 +gradle.version=3.5 diff --git a/kotlin/gigasecond/.gradle/buildOutputCleanup/cache.properties.lock b/kotlin/gigasecond/.gradle/buildOutputCleanup/cache.properties.lock new file mode 100644 index 0000000..40fdece --- /dev/null +++ b/kotlin/gigasecond/.gradle/buildOutputCleanup/cache.properties.lock @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/kotlin/gigasecond/.idea/compiler.xml b/kotlin/gigasecond/.idea/compiler.xml new file mode 100644 index 0000000..6605d57 --- /dev/null +++ b/kotlin/gigasecond/.idea/compiler.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/kotlin/gigasecond/.idea/gradle.xml b/kotlin/gigasecond/.idea/gradle.xml new file mode 100644 index 0000000..20d2df6 --- /dev/null +++ b/kotlin/gigasecond/.idea/gradle.xml @@ -0,0 +1,19 @@ + + + + + + \ No newline at end of file diff --git a/kotlin/gigasecond/.idea/libraries/Gradle__junit_junit_4_12.xml b/kotlin/gigasecond/.idea/libraries/Gradle__junit_junit_4_12.xml new file mode 100644 index 0000000..04c10dd --- /dev/null +++ b/kotlin/gigasecond/.idea/libraries/Gradle__junit_junit_4_12.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/kotlin/gigasecond/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml b/kotlin/gigasecond/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml new file mode 100644 index 0000000..8262f72 --- /dev/null +++ b/kotlin/gigasecond/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/kotlin/gigasecond/.idea/libraries/Gradle__org_jetbrains_annotations_13_0.xml b/kotlin/gigasecond/.idea/libraries/Gradle__org_jetbrains_annotations_13_0.xml new file mode 100644 index 0000000..4f32fde --- /dev/null +++ b/kotlin/gigasecond/.idea/libraries/Gradle__org_jetbrains_annotations_13_0.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/kotlin/gigasecond/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_1_1.xml b/kotlin/gigasecond/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_1_1.xml new file mode 100644 index 0000000..7b6f562 --- /dev/null +++ b/kotlin/gigasecond/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_1_1.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/kotlin/gigasecond/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_test_1_1_1.xml b/kotlin/gigasecond/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_test_1_1_1.xml new file mode 100644 index 0000000..1720158 --- /dev/null +++ b/kotlin/gigasecond/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_test_1_1_1.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/kotlin/gigasecond/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_test_junit_1_1_1.xml b/kotlin/gigasecond/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_test_junit_1_1_1.xml new file mode 100644 index 0000000..21c5d19 --- /dev/null +++ b/kotlin/gigasecond/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_test_junit_1_1_1.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/kotlin/gigasecond/.idea/misc.xml b/kotlin/gigasecond/.idea/misc.xml new file mode 100644 index 0000000..84da703 --- /dev/null +++ b/kotlin/gigasecond/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/kotlin/gigasecond/.idea/modules.xml b/kotlin/gigasecond/.idea/modules.xml new file mode 100644 index 0000000..088ac6c --- /dev/null +++ b/kotlin/gigasecond/.idea/modules.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/kotlin/gigasecond/.idea/modules/gigasecond_main.iml b/kotlin/gigasecond/.idea/modules/gigasecond_main.iml new file mode 100644 index 0000000..5bc0a34 --- /dev/null +++ b/kotlin/gigasecond/.idea/modules/gigasecond_main.iml @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/kotlin/gigasecond/.idea/modules/gigasecond_test.iml b/kotlin/gigasecond/.idea/modules/gigasecond_test.iml new file mode 100644 index 0000000..b62a7bc --- /dev/null +++ b/kotlin/gigasecond/.idea/modules/gigasecond_test.iml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/kotlin/gigasecond/.idea/workspace.xml b/kotlin/gigasecond/.idea/workspace.xml new file mode 100644 index 0000000..33a82ec --- /dev/null +++ b/kotlin/gigasecond/.idea/workspace.xml @@ -0,0 +1,1004 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1496434180845 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/kotlin/gigasecond/README.md b/kotlin/gigasecond/README.md new file mode 100644 index 0000000..ca8090b --- /dev/null +++ b/kotlin/gigasecond/README.md @@ -0,0 +1,13 @@ +# Gigasecond + +Calculate the moment when someone has lived for 10^9 seconds. + +A gigasecond is 10^9 (1,000,000,000) seconds. + +## Source + +Chapter 9 in Chris Pine's online Learn to Program tutorial. [http://pine.fm/LearnToProgram/?Chapter=09](http://pine.fm/LearnToProgram/?Chapter=09) + +## Submitting Incomplete Solutions +It's possible to submit an incomplete solution so you can see how others have completed the exercise. + diff --git a/kotlin/gigasecond/build.gradle b/kotlin/gigasecond/build.gradle new file mode 100644 index 0000000..16c36c0 --- /dev/null +++ b/kotlin/gigasecond/build.gradle @@ -0,0 +1,28 @@ +buildscript { + ext.kotlin_version = '1.1.1' + repositories { + mavenCentral() + } + dependencies { + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + } +} + +apply plugin: 'kotlin' + +repositories { + mavenCentral() +} + +dependencies { + compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" + + testCompile 'junit:junit:4.12' + testCompile "org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version" +} +test { + testLogging { + exceptionFormat = 'full' + events = ["passed", "failed", "skipped"] + } +} diff --git a/kotlin/gigasecond/build/classes/main/Gigasecond.class b/kotlin/gigasecond/build/classes/main/Gigasecond.class new file mode 100644 index 0000000..1b66ebf Binary files /dev/null and b/kotlin/gigasecond/build/classes/main/Gigasecond.class differ diff --git a/kotlin/gigasecond/build/classes/test/GigasecondTest.class b/kotlin/gigasecond/build/classes/test/GigasecondTest.class new file mode 100644 index 0000000..3799ea2 Binary files /dev/null and b/kotlin/gigasecond/build/classes/test/GigasecondTest.class differ diff --git a/kotlin/gigasecond/build/kotlin-build/caches/artifact-difference.tab b/kotlin/gigasecond/build/kotlin-build/caches/artifact-difference.tab new file mode 100644 index 0000000..325acde Binary files /dev/null and b/kotlin/gigasecond/build/kotlin-build/caches/artifact-difference.tab differ diff --git a/kotlin/gigasecond/build/kotlin-build/caches/artifact-difference.tab.len b/kotlin/gigasecond/build/kotlin-build/caches/artifact-difference.tab.len new file mode 100644 index 0000000..60e2d8a Binary files /dev/null and b/kotlin/gigasecond/build/kotlin-build/caches/artifact-difference.tab.len differ diff --git a/kotlin/gigasecond/build/kotlin-build/caches/artifact-difference.tab_i b/kotlin/gigasecond/build/kotlin-build/caches/artifact-difference.tab_i new file mode 100644 index 0000000..e69de29 diff --git a/kotlin/gigasecond/build/kotlin-build/caches/version.txt b/kotlin/gigasecond/build/kotlin-build/caches/version.txt new file mode 100644 index 0000000..01aabac --- /dev/null +++ b/kotlin/gigasecond/build/kotlin-build/caches/version.txt @@ -0,0 +1 @@ +11001 \ No newline at end of file diff --git a/kotlin/gigasecond/build/kotlin-classes/main/Gigasecond$date$1.class b/kotlin/gigasecond/build/kotlin-classes/main/Gigasecond$date$1.class new file mode 100644 index 0000000..8df3ed2 Binary files /dev/null and b/kotlin/gigasecond/build/kotlin-classes/main/Gigasecond$date$1.class differ diff --git a/kotlin/gigasecond/build/kotlin-classes/main/Gigasecond.class b/kotlin/gigasecond/build/kotlin-classes/main/Gigasecond.class new file mode 100644 index 0000000..e026f4a Binary files /dev/null and b/kotlin/gigasecond/build/kotlin-classes/main/Gigasecond.class differ diff --git a/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/class-fq-name-to-source.tab b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/class-fq-name-to-source.tab new file mode 100644 index 0000000..e91dac6 Binary files /dev/null and b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/class-fq-name-to-source.tab differ diff --git a/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/class-fq-name-to-source.tab.keystream b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/class-fq-name-to-source.tab.keystream new file mode 100644 index 0000000..062ab0a Binary files /dev/null and b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/class-fq-name-to-source.tab.keystream differ diff --git a/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/class-fq-name-to-source.tab.keystream.len b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/class-fq-name-to-source.tab.keystream.len new file mode 100644 index 0000000..296694d Binary files /dev/null and b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/class-fq-name-to-source.tab.keystream.len differ diff --git a/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/class-fq-name-to-source.tab.len b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/class-fq-name-to-source.tab.len new file mode 100644 index 0000000..60e2d8a Binary files /dev/null and b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/class-fq-name-to-source.tab.len differ diff --git a/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/class-fq-name-to-source.tab.values.at b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/class-fq-name-to-source.tab.values.at new file mode 100644 index 0000000..5de3a15 Binary files /dev/null and b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/class-fq-name-to-source.tab.values.at differ diff --git a/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/class-fq-name-to-source.tab_i b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/class-fq-name-to-source.tab_i new file mode 100644 index 0000000..87f82b7 Binary files /dev/null and b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/class-fq-name-to-source.tab_i differ diff --git a/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/class-fq-name-to-source.tab_i.len b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/class-fq-name-to-source.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/class-fq-name-to-source.tab_i.len differ diff --git a/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/internal-name-to-source.tab b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/internal-name-to-source.tab new file mode 100644 index 0000000..6bafcf1 Binary files /dev/null and b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/internal-name-to-source.tab differ diff --git a/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/internal-name-to-source.tab.keystream b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/internal-name-to-source.tab.keystream new file mode 100644 index 0000000..250bb22 Binary files /dev/null and b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/internal-name-to-source.tab.keystream differ diff --git a/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/internal-name-to-source.tab.keystream.len b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/internal-name-to-source.tab.keystream.len new file mode 100644 index 0000000..a930d6b Binary files /dev/null and b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/internal-name-to-source.tab.keystream.len differ diff --git a/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/internal-name-to-source.tab.len b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/internal-name-to-source.tab.len new file mode 100644 index 0000000..ad90f24 Binary files /dev/null and b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/internal-name-to-source.tab.len differ diff --git a/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/internal-name-to-source.tab.values.at b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/internal-name-to-source.tab.values.at new file mode 100644 index 0000000..0da1904 Binary files /dev/null and b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/internal-name-to-source.tab.values.at differ diff --git a/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/internal-name-to-source.tab_i b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/internal-name-to-source.tab_i new file mode 100644 index 0000000..c6a074a Binary files /dev/null and b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/internal-name-to-source.tab_i differ diff --git a/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/internal-name-to-source.tab_i.len b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/internal-name-to-source.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/internal-name-to-source.tab_i.len differ diff --git a/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/proto.tab b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/proto.tab new file mode 100644 index 0000000..5268e9d Binary files /dev/null and b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/proto.tab differ diff --git a/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/proto.tab.keystream b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/proto.tab.keystream new file mode 100644 index 0000000..062ab0a Binary files /dev/null and b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/proto.tab.keystream differ diff --git a/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/proto.tab.keystream.len b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/proto.tab.keystream.len new file mode 100644 index 0000000..296694d Binary files /dev/null and b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/proto.tab.keystream.len differ diff --git a/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/proto.tab.len b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/proto.tab.len new file mode 100644 index 0000000..60e2d8a Binary files /dev/null and b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/proto.tab.len differ diff --git a/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/proto.tab.values.at b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/proto.tab.values.at new file mode 100644 index 0000000..10fe331 Binary files /dev/null and b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/proto.tab.values.at differ diff --git a/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/proto.tab_i b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/proto.tab_i new file mode 100644 index 0000000..87f82b7 Binary files /dev/null and b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/proto.tab_i differ diff --git a/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/proto.tab_i.len b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/proto.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/proto.tab_i.len differ diff --git a/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/source-to-classes.tab b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/source-to-classes.tab new file mode 100644 index 0000000..f0d53c1 Binary files /dev/null and b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/source-to-classes.tab differ diff --git a/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/source-to-classes.tab.keystream b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/source-to-classes.tab.keystream new file mode 100644 index 0000000..d3f79e7 Binary files /dev/null and b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/source-to-classes.tab.keystream differ diff --git a/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/source-to-classes.tab.keystream.len b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/source-to-classes.tab.keystream.len new file mode 100644 index 0000000..9ce7b83 Binary files /dev/null and b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/source-to-classes.tab.keystream.len differ diff --git a/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/source-to-classes.tab.len b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/source-to-classes.tab.len new file mode 100644 index 0000000..60e2d8a Binary files /dev/null and b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/source-to-classes.tab.len differ diff --git a/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/source-to-classes.tab.values.at b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/source-to-classes.tab.values.at new file mode 100644 index 0000000..29f9046 Binary files /dev/null and b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/source-to-classes.tab.values.at differ diff --git a/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/source-to-classes.tab_i b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/source-to-classes.tab_i new file mode 100644 index 0000000..563b0c3 Binary files /dev/null and b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/source-to-classes.tab_i differ diff --git a/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/source-to-classes.tab_i.len b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/source-to-classes.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/source-to-classes.tab_i.len differ diff --git a/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/sources-to-classfiles.tab b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/sources-to-classfiles.tab new file mode 100644 index 0000000..32af65b Binary files /dev/null and b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/sources-to-classfiles.tab differ diff --git a/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/sources-to-classfiles.tab.keystream b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/sources-to-classfiles.tab.keystream new file mode 100644 index 0000000..d3f79e7 Binary files /dev/null and b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/sources-to-classfiles.tab.keystream differ diff --git a/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/sources-to-classfiles.tab.keystream.len b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/sources-to-classfiles.tab.keystream.len new file mode 100644 index 0000000..9ce7b83 Binary files /dev/null and b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/sources-to-classfiles.tab.keystream.len differ diff --git a/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/sources-to-classfiles.tab.len b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/sources-to-classfiles.tab.len new file mode 100644 index 0000000..60e2d8a Binary files /dev/null and b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/sources-to-classfiles.tab.len differ diff --git a/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/sources-to-classfiles.tab.values.at b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/sources-to-classfiles.tab.values.at new file mode 100644 index 0000000..fef9cb5 Binary files /dev/null and b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/sources-to-classfiles.tab.values.at differ diff --git a/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/sources-to-classfiles.tab_i b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/sources-to-classfiles.tab_i new file mode 100644 index 0000000..563b0c3 Binary files /dev/null and b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/sources-to-classfiles.tab_i differ diff --git a/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/sources-to-classfiles.tab_i.len b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/sources-to-classfiles.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/increCache.gigasecond_main/kotlin/sources-to-classfiles.tab_i.len differ diff --git a/kotlin/gigasecond/build/kotlin/compileKotlin/caches/lookups/counters.tab b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/lookups/counters.tab new file mode 100644 index 0000000..446a462 --- /dev/null +++ b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/lookups/counters.tab @@ -0,0 +1,2 @@ +3 +2 \ No newline at end of file diff --git a/kotlin/gigasecond/build/kotlin/compileKotlin/caches/lookups/file-to-id.tab b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/lookups/file-to-id.tab new file mode 100644 index 0000000..68db006 Binary files /dev/null and b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/lookups/file-to-id.tab differ diff --git a/kotlin/gigasecond/build/kotlin/compileKotlin/caches/lookups/file-to-id.tab.keystream b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/lookups/file-to-id.tab.keystream new file mode 100644 index 0000000..986c76a Binary files /dev/null and b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/lookups/file-to-id.tab.keystream differ diff --git a/kotlin/gigasecond/build/kotlin/compileKotlin/caches/lookups/file-to-id.tab.keystream.len b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/lookups/file-to-id.tab.keystream.len new file mode 100644 index 0000000..37934e8 Binary files /dev/null and b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/lookups/file-to-id.tab.keystream.len differ diff --git a/kotlin/gigasecond/build/kotlin/compileKotlin/caches/lookups/file-to-id.tab.len b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/lookups/file-to-id.tab.len new file mode 100644 index 0000000..60e2d8a Binary files /dev/null and b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/lookups/file-to-id.tab.len differ diff --git a/kotlin/gigasecond/build/kotlin/compileKotlin/caches/lookups/file-to-id.tab.values.at b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/lookups/file-to-id.tab.values.at new file mode 100644 index 0000000..9f383b5 Binary files /dev/null and b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/lookups/file-to-id.tab.values.at differ diff --git a/kotlin/gigasecond/build/kotlin/compileKotlin/caches/lookups/file-to-id.tab_i b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/lookups/file-to-id.tab_i new file mode 100644 index 0000000..563b0c3 Binary files /dev/null and b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/lookups/file-to-id.tab_i differ diff --git a/kotlin/gigasecond/build/kotlin/compileKotlin/caches/lookups/file-to-id.tab_i.len b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/lookups/file-to-id.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/lookups/file-to-id.tab_i.len differ diff --git a/kotlin/gigasecond/build/kotlin/compileKotlin/caches/lookups/id-to-file.tab b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/lookups/id-to-file.tab new file mode 100644 index 0000000..6b7d9b2 Binary files /dev/null and b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/lookups/id-to-file.tab differ diff --git a/kotlin/gigasecond/build/kotlin/compileKotlin/caches/lookups/id-to-file.tab.keystream b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/lookups/id-to-file.tab.keystream new file mode 100644 index 0000000..636f34a Binary files /dev/null and b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/lookups/id-to-file.tab.keystream differ diff --git a/kotlin/gigasecond/build/kotlin/compileKotlin/caches/lookups/id-to-file.tab.keystream.len b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/lookups/id-to-file.tab.keystream.len new file mode 100644 index 0000000..29ce11c Binary files /dev/null and b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/lookups/id-to-file.tab.keystream.len differ diff --git a/kotlin/gigasecond/build/kotlin/compileKotlin/caches/lookups/id-to-file.tab.len b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/lookups/id-to-file.tab.len new file mode 100644 index 0000000..58d450d Binary files /dev/null and b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/lookups/id-to-file.tab.len differ diff --git a/kotlin/gigasecond/build/kotlin/compileKotlin/caches/lookups/id-to-file.tab.values.at b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/lookups/id-to-file.tab.values.at new file mode 100644 index 0000000..b02be12 Binary files /dev/null and b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/lookups/id-to-file.tab.values.at differ diff --git a/kotlin/gigasecond/build/kotlin/compileKotlin/caches/lookups/id-to-file.tab_i b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/lookups/id-to-file.tab_i new file mode 100644 index 0000000..e651c00 Binary files /dev/null and b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/lookups/id-to-file.tab_i differ diff --git a/kotlin/gigasecond/build/kotlin/compileKotlin/caches/lookups/id-to-file.tab_i.len b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/lookups/id-to-file.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/lookups/id-to-file.tab_i.len differ diff --git a/kotlin/gigasecond/build/kotlin/compileKotlin/caches/lookups/lookups.tab b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/lookups/lookups.tab new file mode 100644 index 0000000..dec6952 Binary files /dev/null and b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/lookups/lookups.tab differ diff --git a/kotlin/gigasecond/build/kotlin/compileKotlin/caches/lookups/lookups.tab.keystream b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/lookups/lookups.tab.keystream new file mode 100644 index 0000000..d20af58 Binary files /dev/null and b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/lookups/lookups.tab.keystream differ diff --git a/kotlin/gigasecond/build/kotlin/compileKotlin/caches/lookups/lookups.tab.keystream.len b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/lookups/lookups.tab.keystream.len new file mode 100644 index 0000000..14f7c06 Binary files /dev/null and b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/lookups/lookups.tab.keystream.len differ diff --git a/kotlin/gigasecond/build/kotlin/compileKotlin/caches/lookups/lookups.tab.len b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/lookups/lookups.tab.len new file mode 100644 index 0000000..baf20a0 Binary files /dev/null and b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/lookups/lookups.tab.len differ diff --git a/kotlin/gigasecond/build/kotlin/compileKotlin/caches/lookups/lookups.tab.values.at b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/lookups/lookups.tab.values.at new file mode 100644 index 0000000..72dfe73 Binary files /dev/null and b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/lookups/lookups.tab.values.at differ diff --git a/kotlin/gigasecond/build/kotlin/compileKotlin/caches/lookups/lookups.tab_i b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/lookups/lookups.tab_i new file mode 100644 index 0000000..f17e9fb Binary files /dev/null and b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/lookups/lookups.tab_i differ diff --git a/kotlin/gigasecond/build/kotlin/compileKotlin/caches/lookups/lookups.tab_i.len b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/lookups/lookups.tab_i.len new file mode 100644 index 0000000..131e265 Binary files /dev/null and b/kotlin/gigasecond/build/kotlin/compileKotlin/caches/lookups/lookups.tab_i.len differ diff --git a/kotlin/gigasecond/build/kotlin/compileKotlin/data-container-format-version.txt b/kotlin/gigasecond/build/kotlin/compileKotlin/data-container-format-version.txt new file mode 100644 index 0000000..b01b80f --- /dev/null +++ b/kotlin/gigasecond/build/kotlin/compileKotlin/data-container-format-version.txt @@ -0,0 +1 @@ +2011001 \ No newline at end of file diff --git a/kotlin/gigasecond/build/kotlin/compileKotlin/experimental-format-version.txt b/kotlin/gigasecond/build/kotlin/compileKotlin/experimental-format-version.txt new file mode 100644 index 0000000..7289c6b --- /dev/null +++ b/kotlin/gigasecond/build/kotlin/compileKotlin/experimental-format-version.txt @@ -0,0 +1 @@ +4011001 \ No newline at end of file diff --git a/kotlin/gigasecond/build/kotlin/compileKotlin/format-version.txt b/kotlin/gigasecond/build/kotlin/compileKotlin/format-version.txt new file mode 100644 index 0000000..2408adb --- /dev/null +++ b/kotlin/gigasecond/build/kotlin/compileKotlin/format-version.txt @@ -0,0 +1 @@ +8011001 \ No newline at end of file diff --git a/kotlin/gigasecond/build/kotlin/compileKotlin/gradle-format-version.txt b/kotlin/gigasecond/build/kotlin/compileKotlin/gradle-format-version.txt new file mode 100644 index 0000000..178119c --- /dev/null +++ b/kotlin/gigasecond/build/kotlin/compileKotlin/gradle-format-version.txt @@ -0,0 +1 @@ +3011001 \ No newline at end of file diff --git a/kotlin/gigasecond/build/kotlin/compileKotlin/last-build.bin b/kotlin/gigasecond/build/kotlin/compileKotlin/last-build.bin new file mode 100644 index 0000000..e99e234 Binary files /dev/null and b/kotlin/gigasecond/build/kotlin/compileKotlin/last-build.bin differ diff --git a/kotlin/gigasecond/build/kotlin/compileKotlin/sync/kotlin-files-in-java-timestamps.bin b/kotlin/gigasecond/build/kotlin/compileKotlin/sync/kotlin-files-in-java-timestamps.bin new file mode 100644 index 0000000..20505b5 Binary files /dev/null and b/kotlin/gigasecond/build/kotlin/compileKotlin/sync/kotlin-files-in-java-timestamps.bin differ diff --git a/kotlin/gigasecond/build/kotlin/compileTestKotlin/dirty-sources.txt b/kotlin/gigasecond/build/kotlin/compileTestKotlin/dirty-sources.txt new file mode 100644 index 0000000..6c209a9 --- /dev/null +++ b/kotlin/gigasecond/build/kotlin/compileTestKotlin/dirty-sources.txt @@ -0,0 +1 @@ +C:\Users\speed\exercism\kotlin\gigasecond\src\test\kotlin\GigasecondTest.kt \ No newline at end of file diff --git a/kotlin/gigasecond/build/kotlin/compileTestKotlin/last-build.bin b/kotlin/gigasecond/build/kotlin/compileTestKotlin/last-build.bin new file mode 100644 index 0000000..58144d2 Binary files /dev/null and b/kotlin/gigasecond/build/kotlin/compileTestKotlin/last-build.bin differ diff --git a/kotlin/gigasecond/gigasecond.iml b/kotlin/gigasecond/gigasecond.iml new file mode 100644 index 0000000..adc03e4 --- /dev/null +++ b/kotlin/gigasecond/gigasecond.iml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/kotlin/gigasecond/src/main/kotlin/.keep b/kotlin/gigasecond/src/main/kotlin/.keep new file mode 100644 index 0000000..e69de29 diff --git a/kotlin/gigasecond/src/main/kotlin/Gigasecond.kt b/kotlin/gigasecond/src/main/kotlin/Gigasecond.kt new file mode 100644 index 0000000..03a7736 --- /dev/null +++ b/kotlin/gigasecond/src/main/kotlin/Gigasecond.kt @@ -0,0 +1,17 @@ +import java.time.LocalDate +import java.time.LocalDateTime +import java.time.LocalTime +import java.time.temporal.ChronoUnit +import java.time.temporal.Temporal + +class Gigasecond(val dt: Temporal) { + val date: LocalDateTime = + if (dt is LocalDate){ + LocalDateTime.of(dt, LocalTime.MIDNIGHT).plus(1000000000, ChronoUnit.SECONDS) + } + else (LocalDateTime.from(dt).plus(1000000000, ChronoUnit.SECONDS)) + + override fun equals(other: Any?): Boolean { + return (this.date == other) + } +} \ No newline at end of file diff --git a/kotlin/gigasecond/src/test/kotlin/GigasecondTest.kt b/kotlin/gigasecond/src/test/kotlin/GigasecondTest.kt new file mode 100644 index 0000000..ade6d2f --- /dev/null +++ b/kotlin/gigasecond/src/test/kotlin/GigasecondTest.kt @@ -0,0 +1,45 @@ +import org.junit.Test +import org.junit.Ignore +import java.time.LocalDate +import java.time.LocalDateTime +import java.time.Month +import kotlin.test.assertEquals + +class GigasecondTest { + + + @Test + fun modernTime() { + val gigaSecond = Gigasecond(LocalDate.of(2011, Month.APRIL, 25)) + + assertEquals(LocalDateTime.of(2043, Month.JANUARY, 1, 1, 46, 40), gigaSecond.date) + } + + @Test + fun afterEpochTime() { + val gigaSecond = Gigasecond(LocalDate.of(1977, Month.JUNE, 13)) + + assertEquals(LocalDateTime.of(2009, Month.FEBRUARY, 19, 1, 46, 40), gigaSecond.date) + } + + @Test + fun beforeEpochTime() { + val gigaSecond = Gigasecond(LocalDate.of(1959, Month.JULY, 19)) + + assertEquals(LocalDateTime.of(1991, Month.MARCH, 27, 1, 46, 40), gigaSecond.date) + } + + @Test + fun withFullTimeSpecified() { + val gigaSecond = Gigasecond(LocalDateTime.of(2015, Month.JANUARY, 24, 22, 0, 0)) + + assertEquals(LocalDateTime.of(2046, Month.OCTOBER, 2, 23, 46, 40), gigaSecond.date) + } + + @Test + fun withFullTimeSpecifiedAndDayRollover() { + val gigaSecond = Gigasecond(LocalDateTime.of(2015, Month.JANUARY, 24, 23, 59, 59)) + + assertEquals(LocalDateTime.of(2046, Month.OCTOBER, 3, 1, 46, 39), gigaSecond.date) + } +} diff --git a/kotlin/rna-transcription/.gradle/3.5/file-changes/last-build.bin b/kotlin/rna-transcription/.gradle/3.5/file-changes/last-build.bin new file mode 100644 index 0000000..f76dd23 Binary files /dev/null and b/kotlin/rna-transcription/.gradle/3.5/file-changes/last-build.bin differ diff --git a/kotlin/rna-transcription/.gradle/3.5/taskHistory/taskHistory.lock b/kotlin/rna-transcription/.gradle/3.5/taskHistory/taskHistory.lock new file mode 100644 index 0000000..ac97b09 Binary files /dev/null and b/kotlin/rna-transcription/.gradle/3.5/taskHistory/taskHistory.lock differ diff --git a/kotlin/rna-transcription/.gradle/buildOutputCleanup/built.bin b/kotlin/rna-transcription/.gradle/buildOutputCleanup/built.bin new file mode 100644 index 0000000..e69de29 diff --git a/kotlin/rna-transcription/.gradle/buildOutputCleanup/cache.properties b/kotlin/rna-transcription/.gradle/buildOutputCleanup/cache.properties new file mode 100644 index 0000000..4f36e87 --- /dev/null +++ b/kotlin/rna-transcription/.gradle/buildOutputCleanup/cache.properties @@ -0,0 +1,2 @@ +#Fri Jun 02 17:15:35 EDT 2017 +gradle.version=3.5 diff --git a/kotlin/rna-transcription/.gradle/buildOutputCleanup/cache.properties.lock b/kotlin/rna-transcription/.gradle/buildOutputCleanup/cache.properties.lock new file mode 100644 index 0000000..40fdece --- /dev/null +++ b/kotlin/rna-transcription/.gradle/buildOutputCleanup/cache.properties.lock @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/kotlin/rna-transcription/.idea/compiler.xml b/kotlin/rna-transcription/.idea/compiler.xml new file mode 100644 index 0000000..74259c7 --- /dev/null +++ b/kotlin/rna-transcription/.idea/compiler.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/kotlin/rna-transcription/.idea/gradle.xml b/kotlin/rna-transcription/.idea/gradle.xml new file mode 100644 index 0000000..20d2df6 --- /dev/null +++ b/kotlin/rna-transcription/.idea/gradle.xml @@ -0,0 +1,19 @@ + + + + + + \ No newline at end of file diff --git a/kotlin/rna-transcription/.idea/libraries/Gradle__junit_junit_4_12.xml b/kotlin/rna-transcription/.idea/libraries/Gradle__junit_junit_4_12.xml new file mode 100644 index 0000000..04c10dd --- /dev/null +++ b/kotlin/rna-transcription/.idea/libraries/Gradle__junit_junit_4_12.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/kotlin/rna-transcription/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml b/kotlin/rna-transcription/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml new file mode 100644 index 0000000..8262f72 --- /dev/null +++ b/kotlin/rna-transcription/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/kotlin/rna-transcription/.idea/libraries/Gradle__org_jetbrains_annotations_13_0.xml b/kotlin/rna-transcription/.idea/libraries/Gradle__org_jetbrains_annotations_13_0.xml new file mode 100644 index 0000000..4f32fde --- /dev/null +++ b/kotlin/rna-transcription/.idea/libraries/Gradle__org_jetbrains_annotations_13_0.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/kotlin/rna-transcription/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_1_1.xml b/kotlin/rna-transcription/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_1_1.xml new file mode 100644 index 0000000..7b6f562 --- /dev/null +++ b/kotlin/rna-transcription/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_1_1.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/kotlin/rna-transcription/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_test_1_1_1.xml b/kotlin/rna-transcription/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_test_1_1_1.xml new file mode 100644 index 0000000..1720158 --- /dev/null +++ b/kotlin/rna-transcription/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_test_1_1_1.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/kotlin/rna-transcription/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_test_junit_1_1_1.xml b/kotlin/rna-transcription/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_test_junit_1_1_1.xml new file mode 100644 index 0000000..21c5d19 --- /dev/null +++ b/kotlin/rna-transcription/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_test_junit_1_1_1.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/kotlin/rna-transcription/.idea/misc.xml b/kotlin/rna-transcription/.idea/misc.xml new file mode 100644 index 0000000..84da703 --- /dev/null +++ b/kotlin/rna-transcription/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/kotlin/rna-transcription/.idea/modules.xml b/kotlin/rna-transcription/.idea/modules.xml new file mode 100644 index 0000000..1890bc3 --- /dev/null +++ b/kotlin/rna-transcription/.idea/modules.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/kotlin/rna-transcription/.idea/modules/rna-transcription_main.iml b/kotlin/rna-transcription/.idea/modules/rna-transcription_main.iml new file mode 100644 index 0000000..83b3f43 --- /dev/null +++ b/kotlin/rna-transcription/.idea/modules/rna-transcription_main.iml @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/kotlin/rna-transcription/.idea/modules/rna-transcription_test.iml b/kotlin/rna-transcription/.idea/modules/rna-transcription_test.iml new file mode 100644 index 0000000..4afb34a --- /dev/null +++ b/kotlin/rna-transcription/.idea/modules/rna-transcription_test.iml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/kotlin/rna-transcription/.idea/workspace.xml b/kotlin/rna-transcription/.idea/workspace.xml new file mode 100644 index 0000000..0340f52 --- /dev/null +++ b/kotlin/rna-transcription/.idea/workspace.xml @@ -0,0 +1,839 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1496438124537 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/kotlin/rna-transcription/README.md b/kotlin/rna-transcription/README.md new file mode 100644 index 0000000..c0b1a80 --- /dev/null +++ b/kotlin/rna-transcription/README.md @@ -0,0 +1,27 @@ +# Rna Transcription + +Given a DNA strand, return its RNA complement (per RNA transcription). + +Both DNA and RNA strands are a sequence of nucleotides. + +The four nucleotides found in DNA are adenine (**A**), cytosine (**C**), +guanine (**G**) and thymine (**T**). + +The four nucleotides found in RNA are adenine (**A**), cytosine (**C**), +guanine (**G**) and uracil (**U**). + +Given a DNA strand, its transcribed RNA strand is formed by replacing +each nucleotide with its complement: + +* `G` -> `C` +* `C` -> `G` +* `T` -> `A` +* `A` -> `U` + +## Source + +Rosalind [http://rosalind.info/problems/rna](http://rosalind.info/problems/rna) + +## Submitting Incomplete Solutions +It's possible to submit an incomplete solution so you can see how others have completed the exercise. + diff --git a/kotlin/rna-transcription/build.gradle b/kotlin/rna-transcription/build.gradle new file mode 100644 index 0000000..16c36c0 --- /dev/null +++ b/kotlin/rna-transcription/build.gradle @@ -0,0 +1,28 @@ +buildscript { + ext.kotlin_version = '1.1.1' + repositories { + mavenCentral() + } + dependencies { + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + } +} + +apply plugin: 'kotlin' + +repositories { + mavenCentral() +} + +dependencies { + compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" + + testCompile 'junit:junit:4.12' + testCompile "org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version" +} +test { + testLogging { + exceptionFormat = 'full' + events = ["passed", "failed", "skipped"] + } +} diff --git a/kotlin/rna-transcription/build/classes/main/META-INF/rna-transcription_main.kotlin_module b/kotlin/rna-transcription/build/classes/main/META-INF/rna-transcription_main.kotlin_module new file mode 100644 index 0000000..10b4584 Binary files /dev/null and b/kotlin/rna-transcription/build/classes/main/META-INF/rna-transcription_main.kotlin_module differ diff --git a/kotlin/rna-transcription/build/classes/main/RnaTranscriptionKt.class b/kotlin/rna-transcription/build/classes/main/RnaTranscriptionKt.class new file mode 100644 index 0000000..289cbc0 Binary files /dev/null and b/kotlin/rna-transcription/build/classes/main/RnaTranscriptionKt.class differ diff --git a/kotlin/rna-transcription/build/classes/test/RnaTranscriptionTest.class b/kotlin/rna-transcription/build/classes/test/RnaTranscriptionTest.class new file mode 100644 index 0000000..f21b54f Binary files /dev/null and b/kotlin/rna-transcription/build/classes/test/RnaTranscriptionTest.class differ diff --git a/kotlin/rna-transcription/build/kotlin-build/caches/version.txt b/kotlin/rna-transcription/build/kotlin-build/caches/version.txt new file mode 100644 index 0000000..01aabac --- /dev/null +++ b/kotlin/rna-transcription/build/kotlin-build/caches/version.txt @@ -0,0 +1 @@ +11001 \ No newline at end of file diff --git a/kotlin/rna-transcription/rna-transcription.iml b/kotlin/rna-transcription/rna-transcription.iml new file mode 100644 index 0000000..3b0b656 --- /dev/null +++ b/kotlin/rna-transcription/rna-transcription.iml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/kotlin/rna-transcription/src/main/kotlin/RnaTranscription.kt b/kotlin/rna-transcription/src/main/kotlin/RnaTranscription.kt new file mode 100644 index 0000000..d87c0fd --- /dev/null +++ b/kotlin/rna-transcription/src/main/kotlin/RnaTranscription.kt @@ -0,0 +1,11 @@ +fun transcribeToRna(dna: String): String = dna.map { switchChar(it) }.joinToString(separator = "") + +fun switchChar(inpChar: Char) : String { + when (inpChar) { + 'G' -> return "C" + 'C' -> return "G" + 'T' -> return "A" + 'A' -> return "U" + else -> return "HOW" + } +} \ No newline at end of file diff --git a/kotlin/rna-transcription/src/test/kotlin/RnaTranscriptionTest.kt b/kotlin/rna-transcription/src/test/kotlin/RnaTranscriptionTest.kt new file mode 100644 index 0000000..b576c5a --- /dev/null +++ b/kotlin/rna-transcription/src/test/kotlin/RnaTranscriptionTest.kt @@ -0,0 +1,46 @@ +import org.junit.Assert; +import org.junit.Test +import org.junit.Ignore; + +class RnaTranscriptionTest { + + /* + In Kotlin functions can be declared at top level in a file, meaning + you do not need to create a class to hold a function, like languages + such as Java, C# or Scala. + + http://kotlinlang.org/docs/reference/functions.html#function-scope + + */ + + + @Test + fun emptyDnaIsEmptyRna() { + Assert.assertEquals("", transcribeToRna("")) + } + + @Test + fun cytosineIsGuanine() { + Assert.assertEquals("G", transcribeToRna("C")) + } + + @Test + fun guanineIsCytosine() { + Assert.assertEquals("C", transcribeToRna("G")) + } + + @Test + fun thymineIsAdenine() { + Assert.assertEquals("A", transcribeToRna("T")) + } + + @Test + fun adenineIsUracil() { + Assert.assertEquals("U", transcribeToRna("A")) + } + + @Test + fun rnaTranscription() { + Assert.assertEquals("UGCACCAGAAUU", transcribeToRna("ACGTGGTCTTAA")) + } +} diff --git a/kotlin/test/.idea/libraries/KotlinJavaRuntime.xml b/kotlin/test/.idea/libraries/KotlinJavaRuntime.xml new file mode 100644 index 0000000..c630c0b --- /dev/null +++ b/kotlin/test/.idea/libraries/KotlinJavaRuntime.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/kotlin/test/.idea/misc.xml b/kotlin/test/.idea/misc.xml new file mode 100644 index 0000000..0548357 --- /dev/null +++ b/kotlin/test/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/kotlin/test/.idea/modules.xml b/kotlin/test/.idea/modules.xml new file mode 100644 index 0000000..ea6e2e7 --- /dev/null +++ b/kotlin/test/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/kotlin/test/.idea/workspace.xml b/kotlin/test/.idea/workspace.xml new file mode 100644 index 0000000..b6e6f18 --- /dev/null +++ b/kotlin/test/.idea/workspace.xml @@ -0,0 +1,432 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1496435516327 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/kotlin/test/out/production/test/Gigasecond.class b/kotlin/test/out/production/test/Gigasecond.class new file mode 100644 index 0000000..5ddb73c Binary files /dev/null and b/kotlin/test/out/production/test/Gigasecond.class differ diff --git a/kotlin/test/out/production/test/META-INF/test.kotlin_module b/kotlin/test/out/production/test/META-INF/test.kotlin_module new file mode 100644 index 0000000..ebc01e5 Binary files /dev/null and b/kotlin/test/out/production/test/META-INF/test.kotlin_module differ diff --git a/kotlin/test/out/production/test/MainKt.class b/kotlin/test/out/production/test/MainKt.class new file mode 100644 index 0000000..11f7905 Binary files /dev/null and b/kotlin/test/out/production/test/MainKt.class differ diff --git a/kotlin/test/src/main.kt b/kotlin/test/src/main.kt new file mode 100644 index 0000000..d11b384 --- /dev/null +++ b/kotlin/test/src/main.kt @@ -0,0 +1,13 @@ +import java.time.LocalDateTime +import java.time.Month +import java.time.temporal.ChronoUnit +import java.time.temporal.Temporal + +class Gigasecond(val dt: Temporal) { + val date: LocalDateTime = LocalDateTime.from(dt.plus(1000000000, ChronoUnit.SECONDS)) + +} + +fun main(args: Array) { + print(Gigasecond(LocalDateTime.of(2043, Month.JANUARY, 1, 1, 46, 40)).date) +} \ No newline at end of file diff --git a/kotlin/test/test.iml b/kotlin/test/test.iml new file mode 100644 index 0000000..245d342 --- /dev/null +++ b/kotlin/test/test.iml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/kotlin/word-count/.gradle/3.5/file-changes/last-build.bin b/kotlin/word-count/.gradle/3.5/file-changes/last-build.bin new file mode 100644 index 0000000..f76dd23 Binary files /dev/null and b/kotlin/word-count/.gradle/3.5/file-changes/last-build.bin differ diff --git a/kotlin/word-count/.gradle/3.5/taskHistory/taskHistory.lock b/kotlin/word-count/.gradle/3.5/taskHistory/taskHistory.lock new file mode 100644 index 0000000..2980049 Binary files /dev/null and b/kotlin/word-count/.gradle/3.5/taskHistory/taskHistory.lock differ diff --git a/kotlin/word-count/.gradle/buildOutputCleanup/built.bin b/kotlin/word-count/.gradle/buildOutputCleanup/built.bin new file mode 100644 index 0000000..e69de29 diff --git a/kotlin/word-count/.gradle/buildOutputCleanup/cache.properties b/kotlin/word-count/.gradle/buildOutputCleanup/cache.properties new file mode 100644 index 0000000..6cfc6d9 --- /dev/null +++ b/kotlin/word-count/.gradle/buildOutputCleanup/cache.properties @@ -0,0 +1,2 @@ +#Fri Jun 02 17:53:36 EDT 2017 +gradle.version=3.5 diff --git a/kotlin/word-count/.gradle/buildOutputCleanup/cache.properties.lock b/kotlin/word-count/.gradle/buildOutputCleanup/cache.properties.lock new file mode 100644 index 0000000..40fdece --- /dev/null +++ b/kotlin/word-count/.gradle/buildOutputCleanup/cache.properties.lock @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/kotlin/word-count/.idea/compiler.xml b/kotlin/word-count/.idea/compiler.xml new file mode 100644 index 0000000..131c0af --- /dev/null +++ b/kotlin/word-count/.idea/compiler.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/kotlin/word-count/.idea/gradle.xml b/kotlin/word-count/.idea/gradle.xml new file mode 100644 index 0000000..20d2df6 --- /dev/null +++ b/kotlin/word-count/.idea/gradle.xml @@ -0,0 +1,19 @@ + + + + + + \ No newline at end of file diff --git a/kotlin/word-count/.idea/libraries/Gradle__junit_junit_4_12.xml b/kotlin/word-count/.idea/libraries/Gradle__junit_junit_4_12.xml new file mode 100644 index 0000000..04c10dd --- /dev/null +++ b/kotlin/word-count/.idea/libraries/Gradle__junit_junit_4_12.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/kotlin/word-count/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml b/kotlin/word-count/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml new file mode 100644 index 0000000..8262f72 --- /dev/null +++ b/kotlin/word-count/.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/kotlin/word-count/.idea/libraries/Gradle__org_jetbrains_annotations_13_0.xml b/kotlin/word-count/.idea/libraries/Gradle__org_jetbrains_annotations_13_0.xml new file mode 100644 index 0000000..4f32fde --- /dev/null +++ b/kotlin/word-count/.idea/libraries/Gradle__org_jetbrains_annotations_13_0.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/kotlin/word-count/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_1_1.xml b/kotlin/word-count/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_1_1.xml new file mode 100644 index 0000000..7b6f562 --- /dev/null +++ b/kotlin/word-count/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_1_1.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/kotlin/word-count/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_test_1_1_1.xml b/kotlin/word-count/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_test_1_1_1.xml new file mode 100644 index 0000000..1720158 --- /dev/null +++ b/kotlin/word-count/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_test_1_1_1.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/kotlin/word-count/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_test_junit_1_1_1.xml b/kotlin/word-count/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_test_junit_1_1_1.xml new file mode 100644 index 0000000..21c5d19 --- /dev/null +++ b/kotlin/word-count/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_test_junit_1_1_1.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/kotlin/word-count/.idea/misc.xml b/kotlin/word-count/.idea/misc.xml new file mode 100644 index 0000000..84da703 --- /dev/null +++ b/kotlin/word-count/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/kotlin/word-count/.idea/modules.xml b/kotlin/word-count/.idea/modules.xml new file mode 100644 index 0000000..d8e5298 --- /dev/null +++ b/kotlin/word-count/.idea/modules.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/kotlin/word-count/.idea/modules/word-count_main.iml b/kotlin/word-count/.idea/modules/word-count_main.iml new file mode 100644 index 0000000..7f29d7a --- /dev/null +++ b/kotlin/word-count/.idea/modules/word-count_main.iml @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/kotlin/word-count/.idea/modules/word-count_test.iml b/kotlin/word-count/.idea/modules/word-count_test.iml new file mode 100644 index 0000000..d0549b5 --- /dev/null +++ b/kotlin/word-count/.idea/modules/word-count_test.iml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/kotlin/word-count/.idea/workspace.xml b/kotlin/word-count/.idea/workspace.xml new file mode 100644 index 0000000..3a0e964 --- /dev/null +++ b/kotlin/word-count/.idea/workspace.xml @@ -0,0 +1,940 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @Ignore + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1496440410222 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/kotlin/word-count/README.md b/kotlin/word-count/README.md new file mode 100644 index 0000000..42382ce --- /dev/null +++ b/kotlin/word-count/README.md @@ -0,0 +1,20 @@ +# Word Count + +Given a phrase, count the occurrences of each word in that phrase. + +For example for the input `"olly olly in come free"` + +```plain +olly: 2 +in: 1 +come: 1 +free: 1 +``` + +## Source + +This is a classic toy problem, but we were reminded of it by seeing it in the Go Tour. + +## Submitting Incomplete Solutions +It's possible to submit an incomplete solution so you can see how others have completed the exercise. + diff --git a/kotlin/word-count/build.gradle b/kotlin/word-count/build.gradle new file mode 100644 index 0000000..16c36c0 --- /dev/null +++ b/kotlin/word-count/build.gradle @@ -0,0 +1,28 @@ +buildscript { + ext.kotlin_version = '1.1.1' + repositories { + mavenCentral() + } + dependencies { + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + } +} + +apply plugin: 'kotlin' + +repositories { + mavenCentral() +} + +dependencies { + compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" + + testCompile 'junit:junit:4.12' + testCompile "org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version" +} +test { + testLogging { + exceptionFormat = 'full' + events = ["passed", "failed", "skipped"] + } +} diff --git a/kotlin/word-count/build/classes/test/WordCountTest.class b/kotlin/word-count/build/classes/test/WordCountTest.class new file mode 100644 index 0000000..7f96de3 Binary files /dev/null and b/kotlin/word-count/build/classes/test/WordCountTest.class differ diff --git a/kotlin/word-count/build/kotlin-build/caches/version.txt b/kotlin/word-count/build/kotlin-build/caches/version.txt new file mode 100644 index 0000000..01aabac --- /dev/null +++ b/kotlin/word-count/build/kotlin-build/caches/version.txt @@ -0,0 +1 @@ +11001 \ No newline at end of file diff --git a/kotlin/word-count/src/main/kotlin/.keep b/kotlin/word-count/src/main/kotlin/.keep new file mode 100644 index 0000000..e69de29 diff --git a/kotlin/word-count/src/main/kotlin/WordCount.kt b/kotlin/word-count/src/main/kotlin/WordCount.kt new file mode 100644 index 0000000..8c09cf6 --- /dev/null +++ b/kotlin/word-count/src/main/kotlin/WordCount.kt @@ -0,0 +1,17 @@ +object WordCount { + fun phrase(str: String): Map{ + var outMap: MutableMap = emptyMap().toMutableMap() + val stringList: List = str.split(delimiters = " ") + val partiallyCleanedList: List = stringList.filter { it.trim().isNotEmpty() } + // This is where it is broken + val properlyCleanedList: List = partiallyCleanedList.map { it } + val blorp: List = properlyCleanedList.filter { it.isNotEmpty() } + for (word in blorp){ + if (outMap.containsKey(word)){ + outMap[word]!!.inc() + } + else outMap.put(word, 0) + } + return outMap; + } +} \ No newline at end of file diff --git a/kotlin/word-count/src/test/kotlin/WordCountTest.kt b/kotlin/word-count/src/test/kotlin/WordCountTest.kt new file mode 100644 index 0000000..d97f4b1 --- /dev/null +++ b/kotlin/word-count/src/test/kotlin/WordCountTest.kt @@ -0,0 +1,64 @@ +import org.junit.Test +import org.junit.Ignore +import kotlin.test.assertEquals + +class WordCountTest { + + + @Test + fun countOneWord() { + val expectedWordCount = mapOf("word" to 1) + + assertEquals(expectedWordCount, WordCount.phrase("word")) + } + + + @Test + fun countOneOfEach() { + val expectedWordCount = mapOf("one" to 1, "of" to 1, "each" to 1) + + assertEquals(expectedWordCount, WordCount.phrase("one of each")) + } + + + @Test + fun countMultipleOccurences() { + val expectedWordCount = mapOf("one" to 1, "fish" to 4, "two" to 1, "red" to 1, "blue" to 1) + + assertEquals(expectedWordCount, WordCount.phrase("one fish two fish red fish blue fish")) + } + + + @Test + fun ignorePunctuation() { + val expectedWordCount = mapOf("car" to 1, "carpet" to 1, "as" to 1, "java" to 1, "javascript" to 1) + + assertEquals(expectedWordCount, WordCount.phrase("car : carpet as java : javascript!!&@$%^&")) + + } + + + @Test + fun includeNumbers() { + val expectedWordCount = mapOf("testing" to 2, "1" to 1, "2" to 1) + + assertEquals(expectedWordCount, WordCount.phrase("testing, 1, 2 testing")) + } + + + @Test + fun normalizeCase() { + val expectedWordCount = mapOf("go" to 3) + + assertEquals(expectedWordCount, WordCount.phrase("go Go GO")) + } + + + @Test + fun allowApostrophes() { + val expectedWordCount = mapOf("first" to 1, "don't" to 2, "laugh" to 1, "then" to 1, "cry" to 1) + + assertEquals(expectedWordCount, WordCount.phrase("First: don't laugh. Then: don't cry.")) + } + +} diff --git a/kotlin/word-count/word-count.iml b/kotlin/word-count/word-count.iml new file mode 100644 index 0000000..dc03e15 --- /dev/null +++ b/kotlin/word-count/word-count.iml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file