trackler 2.2.1.128 → 2.2.1.129
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/trackler/version.rb +1 -1
- data/problem-specifications/exercises/bracket-push/canonical-data.json +9 -1
- data/tracks/bash/config.json +3 -3
- data/tracks/ceylon/exercises/bracket-push/source/bracketpush/BracketsTest.ceylon +3 -1
- data/tracks/crystal/exercises/difference-of-squares/spec/difference_of_squares_spec.cr +9 -9
- data/tracks/csharp/config.json +12 -0
- data/tracks/csharp/exercises/Exercises.sln +7 -1
- data/tracks/csharp/exercises/yacht/Example.cs +71 -0
- data/tracks/csharp/exercises/yacht/README.md +34 -0
- data/tracks/csharp/exercises/yacht/Yacht.cs +26 -0
- data/tracks/csharp/exercises/yacht/Yacht.csproj +18 -0
- data/tracks/csharp/exercises/yacht/YachtTest.cs +162 -0
- data/tracks/csharp/generators/Exercises/Yacht.cs +20 -0
- data/tracks/dart/exercises/leap/lib/example.dart +4 -8
- data/tracks/dart/exercises/leap/lib/leap.dart +1 -1
- data/tracks/dart/exercises/leap/test/leap_test.dart +14 -16
- data/tracks/delphi/config.json +11 -0
- data/tracks/delphi/exercises/bracket-push/BracketPush.dpr +60 -0
- data/tracks/delphi/exercises/bracket-push/README.md +31 -0
- data/tracks/delphi/exercises/bracket-push/uBracketPushExample.pas +40 -0
- data/tracks/delphi/exercises/bracket-push/uBracketPushTest.pas +158 -0
- data/tracks/fsharp/config.json +18 -6
- data/tracks/fsharp/exercises/Exercises.sln +7 -1
- data/tracks/fsharp/exercises/accumulate/Accumulate.fsproj +2 -2
- data/tracks/fsharp/exercises/acronym/Acronym.fsproj +2 -2
- data/tracks/fsharp/exercises/all-your-base/AllYourBase.fsproj +2 -2
- data/tracks/fsharp/exercises/allergies/Allergies.fsproj +2 -2
- data/tracks/fsharp/exercises/alphametics/Alphametics.fsproj +2 -2
- data/tracks/fsharp/exercises/anagram/Anagram.fsproj +2 -2
- data/tracks/fsharp/exercises/armstrong-numbers/ArmstrongNumbers.fsproj +2 -2
- data/tracks/fsharp/exercises/atbash-cipher/AtbashCipher.fsproj +2 -2
- data/tracks/fsharp/exercises/bank-account/BankAccount.fsproj +2 -2
- data/tracks/fsharp/exercises/beer-song/BeerSong.fsproj +2 -2
- data/tracks/fsharp/exercises/binary/Binary.fsproj +2 -2
- data/tracks/fsharp/exercises/binary-search/BinarySearch.fsproj +2 -2
- data/tracks/fsharp/exercises/binary-search-tree/BinarySearchTree.fsproj +2 -2
- data/tracks/fsharp/exercises/bob/Bob.fsproj +2 -2
- data/tracks/fsharp/exercises/book-store/BookStore.fsproj +2 -2
- data/tracks/fsharp/exercises/bowling/Bowling.fsproj +2 -2
- data/tracks/fsharp/exercises/bowling/BowlingTest.fs +15 -1
- data/tracks/fsharp/exercises/bracket-push/BracketPush.fsproj +2 -2
- data/tracks/fsharp/exercises/change/Change.fsproj +2 -2
- data/tracks/fsharp/exercises/circular-buffer/CircularBuffer.fsproj +2 -2
- data/tracks/fsharp/exercises/circular-buffer/CircularBufferTest.fs +1 -1
- data/tracks/fsharp/exercises/clock/Clock.fsproj +2 -2
- data/tracks/fsharp/exercises/collatz-conjecture/CollatzConjecture.fsproj +2 -2
- data/tracks/fsharp/exercises/complex-numbers/ComplexNumbers.fsproj +2 -2
- data/tracks/fsharp/exercises/connect/Connect.fsproj +2 -2
- data/tracks/fsharp/exercises/crypto-square/CryptoSquare.fsproj +2 -2
- data/tracks/fsharp/exercises/custom-set/CustomSet.fsproj +2 -2
- data/tracks/fsharp/exercises/diamond/Diamond.fsproj +2 -2
- data/tracks/fsharp/exercises/difference-of-squares/DifferenceOfSquares.fsproj +2 -2
- data/tracks/fsharp/exercises/diffie-hellman/DiffieHellman.fsproj +2 -2
- data/tracks/fsharp/exercises/dominoes/Dominoes.fsproj +2 -2
- data/tracks/fsharp/exercises/dot-dsl/DotDsl.fsproj +2 -2
- data/tracks/fsharp/exercises/error-handling/ErrorHandling.fsproj +2 -2
- data/tracks/fsharp/exercises/etl/Etl.fsproj +2 -2
- data/tracks/fsharp/exercises/food-chain/FoodChain.fsproj +2 -2
- data/tracks/fsharp/exercises/forth/Forth.fsproj +2 -2
- data/tracks/fsharp/exercises/forth/ForthTest.fs +1 -1
- data/tracks/fsharp/exercises/gigasecond/Gigasecond.fsproj +2 -2
- data/tracks/fsharp/exercises/go-counting/GoCounting.fsproj +2 -2
- data/tracks/fsharp/exercises/grade-school/GradeSchool.fsproj +2 -2
- data/tracks/fsharp/exercises/grains/Grains.fsproj +2 -2
- data/tracks/fsharp/exercises/grains/GrainsTest.fs +1 -1
- data/tracks/fsharp/exercises/grep/Grep.fsproj +2 -2
- data/tracks/fsharp/exercises/grep/GrepTest.fs +1 -1
- data/tracks/fsharp/exercises/hamming/Hamming.fsproj +2 -2
- data/tracks/fsharp/exercises/hangman/Hangman.fsproj +2 -2
- data/tracks/fsharp/exercises/hello-world/HelloWorld.fsproj +2 -2
- data/tracks/fsharp/exercises/hexadecimal/Hexadecimal.fsproj +2 -2
- data/tracks/fsharp/exercises/house/Example.fs +2 -2
- data/tracks/fsharp/exercises/house/House.fsproj +2 -2
- data/tracks/fsharp/exercises/house/HouseTest.fs +28 -211
- data/tracks/fsharp/exercises/isbn-verifier/IsbnVerifier.fsproj +2 -2
- data/tracks/fsharp/exercises/isbn-verifier/IsbnVerifierTest.fs +2 -2
- data/tracks/fsharp/exercises/isogram/Isogram.fsproj +2 -2
- data/tracks/fsharp/exercises/isogram/IsogramTest.fs +1 -1
- data/tracks/fsharp/exercises/kindergarten-garden/KindergartenGarden.fsproj +2 -2
- data/tracks/fsharp/exercises/largest-series-product/LargestSeriesProduct.fsproj +2 -2
- data/tracks/fsharp/exercises/leap/Leap.fsproj +2 -2
- data/tracks/fsharp/exercises/ledger/Ledger.fsproj +2 -2
- data/tracks/fsharp/exercises/lens-person/LensPerson.fsproj +2 -2
- data/tracks/fsharp/exercises/linked-list/LinkedList.fsproj +2 -2
- data/tracks/fsharp/exercises/list-ops/ListOps.fsproj +2 -2
- data/tracks/fsharp/exercises/list-ops/ListOpsTest.fs +1 -1
- data/tracks/fsharp/exercises/luhn/Luhn.fsproj +2 -2
- data/tracks/fsharp/exercises/markdown/Markdown.fsproj +2 -2
- data/tracks/fsharp/exercises/matrix/Matrix.fsproj +2 -2
- data/tracks/fsharp/exercises/meetup/Meetup.fsproj +2 -2
- data/tracks/fsharp/exercises/minesweeper/Minesweeper.fsproj +2 -2
- data/tracks/fsharp/exercises/nth-prime/NthPrime.fsproj +2 -2
- data/tracks/fsharp/exercises/nucleotide-count/NucleotideCount.fsproj +2 -2
- data/tracks/fsharp/exercises/ocr-numbers/OcrNumbers.fsproj +2 -2
- data/tracks/fsharp/exercises/octal/Octal.fsproj +2 -2
- data/tracks/fsharp/exercises/palindrome-products/PalindromeProducts.fsproj +2 -2
- data/tracks/fsharp/exercises/pangram/Pangram.fsproj +2 -2
- data/tracks/fsharp/exercises/parallel-letter-frequency/ParallelLetterFrequency.fsproj +2 -2
- data/tracks/fsharp/exercises/pascals-triangle/PascalsTriangle.fsproj +2 -2
- data/tracks/fsharp/exercises/perfect-numbers/PerfectNumbers.fsproj +2 -2
- data/tracks/fsharp/exercises/phone-number/PhoneNumber.fsproj +2 -2
- data/tracks/fsharp/exercises/pig-latin/PigLatin.fsproj +2 -2
- data/tracks/fsharp/exercises/poker/Poker.fsproj +2 -2
- data/tracks/fsharp/exercises/pov/Pov.fsproj +2 -2
- data/tracks/fsharp/exercises/pov/PovTest.fs +2 -2
- data/tracks/fsharp/exercises/prime-factors/PrimeFactors.fsproj +2 -2
- data/tracks/fsharp/exercises/protein-translation/ProteinTranslation.fsproj +2 -2
- data/tracks/fsharp/exercises/proverb/Proverb.fsproj +2 -2
- data/tracks/fsharp/exercises/pythagorean-triplet/PythagoreanTriplet.fsproj +2 -2
- data/tracks/fsharp/exercises/queen-attack/QueenAttack.fsproj +2 -2
- data/tracks/fsharp/exercises/rail-fence-cipher/RailFenceCipher.fsproj +2 -2
- data/tracks/fsharp/exercises/raindrops/Raindrops.fsproj +2 -2
- data/tracks/fsharp/exercises/rational-numbers/RationalNumbers.fsproj +2 -2
- data/tracks/fsharp/exercises/react/Example.fs +1 -1
- data/tracks/fsharp/exercises/react/React.fsproj +2 -2
- data/tracks/fsharp/exercises/react/ReactTest.fs +14 -1
- data/tracks/fsharp/exercises/rectangles/Rectangles.fsproj +2 -2
- data/tracks/fsharp/exercises/reverse-string/ReverseString.fsproj +2 -2
- data/tracks/fsharp/exercises/rna-transcription/RnaTranscription.fsproj +2 -2
- data/tracks/fsharp/exercises/robot-name/RobotName.fsproj +2 -2
- data/tracks/fsharp/exercises/robot-simulator/RobotSimulator.fsproj +2 -2
- data/tracks/fsharp/exercises/roman-numerals/RomanNumerals.fsproj +2 -2
- data/tracks/fsharp/exercises/rotational-cipher/RotationalCipher.fsproj +2 -2
- data/tracks/fsharp/exercises/run-length-encoding/RunLengthEncoding.fsproj +2 -2
- data/tracks/fsharp/exercises/saddle-points/SaddlePoints.fsproj +2 -2
- data/tracks/fsharp/exercises/say/Say.fsproj +2 -2
- data/tracks/fsharp/exercises/scale-generator/ScaleGenerator.fsproj +2 -2
- data/tracks/fsharp/exercises/scrabble-score/ScrabbleScore.fsproj +2 -2
- data/tracks/fsharp/exercises/secret-handshake/SecretHandshake.fsproj +2 -2
- data/tracks/fsharp/exercises/series/Series.fsproj +2 -2
- data/tracks/fsharp/exercises/sgf-parsing/SgfParsing.fsproj +2 -2
- data/tracks/fsharp/exercises/sieve/Sieve.fsproj +2 -2
- data/tracks/fsharp/exercises/simple-cipher/SimpleCipher.fsproj +2 -2
- data/tracks/fsharp/exercises/simple-linked-list/SimpleLinkedList.fsproj +2 -2
- data/tracks/fsharp/exercises/space-age/SpaceAge.fsproj +2 -2
- data/tracks/fsharp/exercises/spiral-matrix/SpiralMatrix.fsproj +2 -2
- data/tracks/fsharp/exercises/strain/Strain.fsproj +2 -2
- data/tracks/fsharp/exercises/sublist/Sublist.fsproj +2 -2
- data/tracks/fsharp/exercises/sum-of-multiples/SumOfMultiples.fsproj +2 -2
- data/tracks/fsharp/exercises/tournament/Tournament.fsproj +2 -2
- data/tracks/fsharp/exercises/transpose/Transpose.fsproj +2 -2
- data/tracks/fsharp/exercises/tree-building/TreeBuilding.fsproj +2 -2
- data/tracks/fsharp/exercises/triangle/Triangle.fsproj +2 -2
- data/tracks/fsharp/exercises/trinary/Trinary.fsproj +2 -2
- data/tracks/fsharp/exercises/twelve-days/TwelveDays.fsproj +2 -2
- data/tracks/fsharp/exercises/two-bucket/TwoBucket.fsproj +2 -2
- data/tracks/fsharp/exercises/two-fer/TwoFer.fsproj +2 -2
- data/tracks/fsharp/exercises/variable-length-quantity/VariableLengthQuantity.fsproj +2 -2
- data/tracks/fsharp/exercises/word-count/WordCount.fsproj +2 -2
- data/tracks/fsharp/exercises/word-search/WordSearch.fsproj +2 -2
- data/tracks/fsharp/exercises/word-search/WordSearchTest.fs +1 -1
- data/tracks/fsharp/exercises/wordy/Wordy.fsproj +2 -2
- data/tracks/fsharp/exercises/yacht/Example.fs +65 -0
- data/tracks/fsharp/exercises/yacht/Program.fs +1 -0
- data/tracks/fsharp/exercises/yacht/README.md +34 -0
- data/tracks/fsharp/exercises/yacht/Yacht.fs +17 -0
- data/tracks/fsharp/exercises/yacht/Yacht.fsproj +23 -0
- data/tracks/fsharp/exercises/yacht/YachtTest.fs +113 -0
- data/tracks/fsharp/exercises/zebra-puzzle/ZebraPuzzle.fsproj +2 -2
- data/tracks/fsharp/exercises/zipper/Zipper.fsproj +2 -2
- data/tracks/fsharp/generators/CanonicalData.fs +2 -20
- data/tracks/fsharp/generators/Common.fs +1 -1
- data/tracks/fsharp/generators/Generators.fs +24 -11
- data/tracks/fsharp/generators/Generators.fsproj +4 -4
- data/tracks/fsharp/generators/Options.fs +1 -1
- data/tracks/haskell/exercises/bracket-push/package.yaml +1 -1
- data/tracks/haskell/exercises/bracket-push/test/Tests.hs +4 -0
- data/tracks/java/config.json +13 -0
- data/tracks/java/exercises/dominoes/.meta/src/reference/java/ChainNotFoundException.java +5 -0
- data/tracks/java/exercises/dominoes/.meta/src/reference/java/Domino.java +30 -0
- data/tracks/java/exercises/dominoes/.meta/src/reference/java/Dominoes.java +67 -0
- data/tracks/java/exercises/dominoes/.meta/version +2 -0
- data/tracks/java/exercises/dominoes/README.md +29 -0
- data/tracks/java/exercises/dominoes/build.gradle +18 -0
- data/tracks/java/exercises/dominoes/src/main/java/ChainNotFoundException.java +5 -0
- data/tracks/java/exercises/dominoes/src/main/java/Domino.java +30 -0
- data/tracks/java/exercises/dominoes/src/test/java/DominoesTest.java +230 -0
- data/tracks/java/exercises/settings.gradle +1 -0
- data/tracks/javascript/.eslintignore +0 -1
- data/tracks/javascript/exercises/simple-cipher/example.js +4 -6
- data/tracks/javascript/exercises/simple-cipher/simple-cipher.spec.js +7 -3
- data/tracks/php/config.json +7 -7
- data/tracks/python/config.json +195 -188
- data/tracks/python/exercises/alphametics/alphametics_test.py +1 -0
- data/tracks/python/exercises/bank-account/README.md +20 -1
- data/tracks/python/exercises/go-counting/README.md +2 -0
- data/tracks/python/test/check-exercises.py +1 -1
- data/tracks/rust/_test/ensure-stubs-compile.sh +5 -0
- data/tracks/rust/config/exercise_readme.go.tmpl +1 -1
- data/tracks/rust/config.json +10 -0
- data/tracks/rust/exercises/accumulate/README.md +1 -1
- data/tracks/rust/exercises/acronym/README.md +1 -1
- data/tracks/rust/exercises/all-your-base/README.md +1 -1
- data/tracks/rust/exercises/all-your-base/example.rs +15 -5
- data/tracks/rust/exercises/all-your-base/src/lib.rs +8 -1
- data/tracks/rust/exercises/all-your-base/tests/all-your-base.rs +10 -5
- data/tracks/rust/exercises/allergies/README.md +1 -1
- data/tracks/rust/exercises/alphametics/README.md +1 -1
- data/tracks/rust/exercises/anagram/README.md +1 -1
- data/tracks/rust/exercises/armstrong-numbers/.gitignore +3 -0
- data/tracks/rust/exercises/armstrong-numbers/Cargo.toml +3 -0
- data/tracks/rust/exercises/armstrong-numbers/README.md +51 -0
- data/tracks/rust/exercises/armstrong-numbers/example.rs +7 -0
- data/tracks/rust/exercises/armstrong-numbers/src/lib.rs +3 -0
- data/tracks/rust/exercises/armstrong-numbers/tests/armstrong-numbers.rs +49 -0
- data/tracks/rust/exercises/atbash-cipher/README.md +1 -1
- data/tracks/rust/exercises/beer-song/README.md +1 -1
- data/tracks/rust/exercises/binary-search/README.md +1 -1
- data/tracks/rust/exercises/bob/README.md +1 -1
- data/tracks/rust/exercises/book-store/README.md +1 -1
- data/tracks/rust/exercises/bowling/README.md +1 -1
- data/tracks/rust/exercises/bowling/example.rs +13 -8
- data/tracks/rust/exercises/bowling/src/lib.rs +22 -0
- data/tracks/rust/exercises/bowling/tests/bowling.rs +31 -31
- data/tracks/rust/exercises/bracket-push/README.md +1 -1
- data/tracks/rust/exercises/circular-buffer/README.md +1 -1
- data/tracks/rust/exercises/clock/README.md +1 -1
- data/tracks/rust/exercises/collatz-conjecture/README.md +1 -1
- data/tracks/rust/exercises/crypto-square/README.md +1 -1
- data/tracks/rust/exercises/crypto-square/example.rs +11 -3
- data/tracks/rust/exercises/crypto-square/tests/crypto-square.rs +8 -16
- data/tracks/rust/exercises/custom-set/README.md +1 -1
- data/tracks/rust/exercises/custom-set/example.rs +17 -17
- data/tracks/rust/exercises/custom-set/tests/custom-set.rs +84 -84
- data/tracks/rust/exercises/decimal/README.md +1 -1
- data/tracks/rust/exercises/difference-of-squares/README.md +1 -1
- data/tracks/rust/exercises/diffie-hellman/README.md +1 -1
- data/tracks/rust/exercises/dominoes/README.md +1 -1
- data/tracks/rust/exercises/etl/README.md +1 -1
- data/tracks/rust/exercises/forth/README.md +1 -1
- data/tracks/rust/exercises/gigasecond/README.md +1 -1
- data/tracks/rust/exercises/grade-school/README.md +1 -1
- data/tracks/rust/exercises/grains/README.md +1 -1
- data/tracks/rust/exercises/hamming/README.md +1 -1
- data/tracks/rust/exercises/hello-world/README.md +1 -1
- data/tracks/rust/exercises/hexadecimal/README.md +1 -1
- data/tracks/rust/exercises/isbn-verifier/README.md +1 -1
- data/tracks/rust/exercises/isogram/README.md +1 -1
- data/tracks/rust/exercises/largest-series-product/README.md +1 -1
- data/tracks/rust/exercises/largest-series-product/example.rs +10 -4
- data/tracks/rust/exercises/largest-series-product/src/lib.rs +9 -0
- data/tracks/rust/exercises/largest-series-product/tests/largest-series-product.rs +3 -3
- data/tracks/rust/exercises/leap/README.md +1 -1
- data/tracks/rust/exercises/luhn/README.md +1 -1
- data/tracks/rust/exercises/luhn-from/README.md +1 -1
- data/tracks/rust/exercises/luhn-trait/README.md +1 -1
- data/tracks/rust/exercises/macros/.meta/ALLOWED_TO_NOT_COMPILE +2 -0
- data/tracks/rust/exercises/macros/README.md +1 -1
- data/tracks/rust/exercises/minesweeper/README.md +1 -1
- data/tracks/rust/exercises/nth-prime/README.md +1 -1
- data/tracks/rust/exercises/nucleotide-codons/README.md +1 -1
- data/tracks/rust/exercises/nucleotide-count/README.md +1 -1
- data/tracks/rust/exercises/ocr-numbers/README.md +1 -1
- data/tracks/rust/exercises/ocr-numbers/example.rs +14 -6
- data/tracks/rust/exercises/ocr-numbers/src/lib.rs +7 -1
- data/tracks/rust/exercises/ocr-numbers/tests/ocr-numbers.rs +2 -2
- data/tracks/rust/exercises/pangram/README.md +1 -1
- data/tracks/rust/exercises/parallel-letter-frequency/README.md +1 -1
- data/tracks/rust/exercises/pascals-triangle/README.md +1 -1
- data/tracks/rust/exercises/perfect-numbers/README.md +1 -1
- data/tracks/rust/exercises/phone-number/README.md +1 -1
- data/tracks/rust/exercises/pig-latin/README.md +1 -1
- data/tracks/rust/exercises/poker/README.md +1 -1
- data/tracks/rust/exercises/prime-factors/README.md +1 -1
- data/tracks/rust/exercises/protein-translation/README.md +1 -1
- data/tracks/rust/exercises/proverb/README.md +1 -1
- data/tracks/rust/exercises/pythagorean-triplet/README.md +1 -1
- data/tracks/rust/exercises/queen-attack/README.md +1 -1
- data/tracks/rust/exercises/raindrops/README.md +1 -1
- data/tracks/rust/exercises/react/README.md +1 -1
- data/tracks/rust/exercises/react/example.rs +27 -18
- data/tracks/rust/exercises/react/src/lib.rs +25 -10
- data/tracks/rust/exercises/react/tests/react.rs +113 -83
- data/tracks/rust/exercises/rectangles/README.md +1 -1
- data/tracks/rust/exercises/reverse-string/README.md +1 -1
- data/tracks/rust/exercises/rna-transcription/README.md +1 -1
- data/tracks/rust/exercises/robot-name/README.md +1 -1
- data/tracks/rust/exercises/robot-simulator/README.md +1 -1
- data/tracks/rust/exercises/roman-numerals/README.md +1 -1
- data/tracks/rust/exercises/rotational-cipher/README.md +1 -1
- data/tracks/rust/exercises/run-length-encoding/README.md +1 -1
- data/tracks/rust/exercises/saddle-points/README.md +1 -1
- data/tracks/rust/exercises/say/README.md +1 -1
- data/tracks/rust/exercises/scrabble-score/README.md +1 -1
- data/tracks/rust/exercises/series/README.md +1 -1
- data/tracks/rust/exercises/sieve/README.md +1 -1
- data/tracks/rust/exercises/simple-linked-list/README.md +1 -1
- data/tracks/rust/exercises/space-age/README.md +1 -1
- data/tracks/rust/exercises/sublist/README.md +1 -1
- data/tracks/rust/exercises/sum-of-multiples/README.md +1 -1
- data/tracks/rust/exercises/tournament/README.md +1 -1
- data/tracks/rust/exercises/triangle/README.md +1 -1
- data/tracks/rust/exercises/two-bucket/README.md +1 -1
- data/tracks/rust/exercises/variable-length-quantity/README.md +1 -1
- data/tracks/rust/exercises/word-count/README.md +1 -1
- data/tracks/rust/exercises/wordy/README.md +1 -1
- data/tracks/typescript/config.json +11 -0
- data/tracks/typescript/exercises/list-ops/README.md +35 -0
- data/tracks/typescript/exercises/list-ops/list-ops.example.ts +80 -0
- data/tracks/typescript/exercises/list-ops/list-ops.test.ts +117 -0
- data/tracks/typescript/exercises/list-ops/list-ops.ts +0 -0
- data/tracks/typescript/exercises/list-ops/package.json +36 -0
- data/tracks/typescript/exercises/list-ops/tsconfig.json +22 -0
- data/tracks/typescript/exercises/list-ops/tslint.json +127 -0
- data/tracks/typescript/exercises/list-ops/yarn.lock +2624 -0
- metadata +42 -3
- data/tracks/dart/exercises/leap/pubspec.lock +0 -293
@@ -42,7 +42,7 @@ haven't already, it will help you with organizing your files.
|
|
42
42
|
|
43
43
|
## Feedback, Issues, Pull Requests
|
44
44
|
|
45
|
-
The [exercism/rust](https://github.com/exercism/rust) repository on GitHub is the home for all of the Rust exercises. If you have feedback about an exercise, or want to help implement new exercises, head over there and create an issue. Members of the
|
45
|
+
The [exercism/rust](https://github.com/exercism/rust) repository on GitHub is the home for all of the Rust exercises. If you have feedback about an exercise, or want to help implement new exercises, head over there and create an issue. Members of the rust track team are happy to help!
|
46
46
|
|
47
47
|
If you want to know more about Exercism, take a look at the [contribution guide](https://github.com/exercism/docs/blob/master/contributing-to-language-tracks/README.md).
|
48
48
|
|
@@ -54,7 +54,7 @@ haven't already, it will help you with organizing your files.
|
|
54
54
|
|
55
55
|
## Feedback, Issues, Pull Requests
|
56
56
|
|
57
|
-
The [exercism/rust](https://github.com/exercism/rust) repository on GitHub is the home for all of the Rust exercises. If you have feedback about an exercise, or want to help implement new exercises, head over there and create an issue. Members of the
|
57
|
+
The [exercism/rust](https://github.com/exercism/rust) repository on GitHub is the home for all of the Rust exercises. If you have feedback about an exercise, or want to help implement new exercises, head over there and create an issue. Members of the rust track team are happy to help!
|
58
58
|
|
59
59
|
If you want to know more about Exercism, take a look at the [contribution guide](https://github.com/exercism/docs/blob/master/contributing-to-language-tracks/README.md).
|
60
60
|
|
@@ -50,7 +50,7 @@ haven't already, it will help you with organizing your files.
|
|
50
50
|
|
51
51
|
## Feedback, Issues, Pull Requests
|
52
52
|
|
53
|
-
The [exercism/rust](https://github.com/exercism/rust) repository on GitHub is the home for all of the Rust exercises. If you have feedback about an exercise, or want to help implement new exercises, head over there and create an issue. Members of the
|
53
|
+
The [exercism/rust](https://github.com/exercism/rust) repository on GitHub is the home for all of the Rust exercises. If you have feedback about an exercise, or want to help implement new exercises, head over there and create an issue. Members of the rust track team are happy to help!
|
54
54
|
|
55
55
|
If you want to know more about Exercism, take a look at the [contribution guide](https://github.com/exercism/docs/blob/master/contributing-to-language-tracks/README.md).
|
56
56
|
|
@@ -32,7 +32,7 @@ haven't already, it will help you with organizing your files.
|
|
32
32
|
|
33
33
|
## Feedback, Issues, Pull Requests
|
34
34
|
|
35
|
-
The [exercism/rust](https://github.com/exercism/rust) repository on GitHub is the home for all of the Rust exercises. If you have feedback about an exercise, or want to help implement new exercises, head over there and create an issue. Members of the
|
35
|
+
The [exercism/rust](https://github.com/exercism/rust) repository on GitHub is the home for all of the Rust exercises. If you have feedback about an exercise, or want to help implement new exercises, head over there and create an issue. Members of the rust track team are happy to help!
|
36
36
|
|
37
37
|
If you want to know more about Exercism, take a look at the [contribution guide](https://github.com/exercism/docs/blob/master/contributing-to-language-tracks/README.md).
|
38
38
|
|
@@ -42,7 +42,7 @@ haven't already, it will help you with organizing your files.
|
|
42
42
|
|
43
43
|
## Feedback, Issues, Pull Requests
|
44
44
|
|
45
|
-
The [exercism/rust](https://github.com/exercism/rust) repository on GitHub is the home for all of the Rust exercises. If you have feedback about an exercise, or want to help implement new exercises, head over there and create an issue. Members of the
|
45
|
+
The [exercism/rust](https://github.com/exercism/rust) repository on GitHub is the home for all of the Rust exercises. If you have feedback about an exercise, or want to help implement new exercises, head over there and create an issue. Members of the rust track team are happy to help!
|
46
46
|
|
47
47
|
If you want to know more about Exercism, take a look at the [contribution guide](https://github.com/exercism/docs/blob/master/contributing-to-language-tracks/README.md).
|
48
48
|
|
@@ -36,7 +36,7 @@ haven't already, it will help you with organizing your files.
|
|
36
36
|
|
37
37
|
## Feedback, Issues, Pull Requests
|
38
38
|
|
39
|
-
The [exercism/rust](https://github.com/exercism/rust) repository on GitHub is the home for all of the Rust exercises. If you have feedback about an exercise, or want to help implement new exercises, head over there and create an issue. Members of the
|
39
|
+
The [exercism/rust](https://github.com/exercism/rust) repository on GitHub is the home for all of the Rust exercises. If you have feedback about an exercise, or want to help implement new exercises, head over there and create an issue. Members of the rust track team are happy to help!
|
40
40
|
|
41
41
|
If you want to know more about Exercism, take a look at the [contribution guide](https://github.com/exercism/docs/blob/master/contributing-to-language-tracks/README.md).
|
42
42
|
|
@@ -102,7 +102,7 @@ haven't already, it will help you with organizing your files.
|
|
102
102
|
|
103
103
|
## Feedback, Issues, Pull Requests
|
104
104
|
|
105
|
-
The [exercism/rust](https://github.com/exercism/rust) repository on GitHub is the home for all of the Rust exercises. If you have feedback about an exercise, or want to help implement new exercises, head over there and create an issue. Members of the
|
105
|
+
The [exercism/rust](https://github.com/exercism/rust) repository on GitHub is the home for all of the Rust exercises. If you have feedback about an exercise, or want to help implement new exercises, head over there and create an issue. Members of the rust track team are happy to help!
|
106
106
|
|
107
107
|
If you want to know more about Exercism, take a look at the [contribution guide](https://github.com/exercism/docs/blob/master/contributing-to-language-tracks/README.md).
|
108
108
|
|
@@ -1,13 +1,21 @@
|
|
1
1
|
use std::collections::BTreeMap;
|
2
|
-
use std::str::Lines;
|
3
2
|
|
4
|
-
|
5
|
-
|
3
|
+
#[derive(Debug, PartialEq)]
|
4
|
+
pub enum Error {
|
5
|
+
InvalidRowCount(usize),
|
6
|
+
InvalidColumnCount(usize),
|
6
7
|
}
|
7
8
|
|
8
|
-
pub fn convert(input: &str) -> Result<String,
|
9
|
-
|
10
|
-
|
9
|
+
pub fn convert(input: &str) -> Result<String, Error> {
|
10
|
+
let line_count = input.lines().count();
|
11
|
+
if line_count % 4 != 0 {
|
12
|
+
return Err(Error::InvalidRowCount(line_count));
|
13
|
+
}
|
14
|
+
for line in input.lines() {
|
15
|
+
let char_count = line.chars().count();
|
16
|
+
if char_count % 3 != 0 {
|
17
|
+
return Err(Error::InvalidColumnCount(char_count));
|
18
|
+
}
|
11
19
|
}
|
12
20
|
|
13
21
|
let y = input.lines().collect::<Vec<_>>();
|
@@ -1,7 +1,13 @@
|
|
1
1
|
// The code below is a stub. Just enough to satisfy the compiler.
|
2
2
|
// In order to pass the tests you can add-to or change any of this code.
|
3
3
|
|
4
|
+
#[derive(Debug, PartialEq)]
|
5
|
+
pub enum Error {
|
6
|
+
InvalidRowCount(usize),
|
7
|
+
InvalidColumnCount(usize),
|
8
|
+
}
|
9
|
+
|
4
10
|
#[allow(unused_variables)]
|
5
|
-
pub fn convert(input: &str) -> Result<String,
|
11
|
+
pub fn convert(input: &str) -> Result<String, Error> {
|
6
12
|
unimplemented!();
|
7
13
|
}
|
@@ -7,7 +7,7 @@ fn input_with_lines_not_multiple_of_four_is_error() {
|
|
7
7
|
"| |\n" +
|
8
8
|
" ";
|
9
9
|
|
10
|
-
|
10
|
+
assert_eq!(Err(ocr::Error::InvalidRowCount(3)), ocr::convert(&input));
|
11
11
|
}
|
12
12
|
|
13
13
|
#[test]
|
@@ -19,7 +19,7 @@ fn input_with_columns_not_multiple_of_three_is_error() {
|
|
19
19
|
" |\n" +
|
20
20
|
" ";
|
21
21
|
|
22
|
-
|
22
|
+
assert_eq!(Err(ocr::Error::InvalidColumnCount(4)), ocr::convert(&input));
|
23
23
|
}
|
24
24
|
|
25
25
|
|
@@ -32,7 +32,7 @@ haven't already, it will help you with organizing your files.
|
|
32
32
|
|
33
33
|
## Feedback, Issues, Pull Requests
|
34
34
|
|
35
|
-
The [exercism/rust](https://github.com/exercism/rust) repository on GitHub is the home for all of the Rust exercises. If you have feedback about an exercise, or want to help implement new exercises, head over there and create an issue. Members of the
|
35
|
+
The [exercism/rust](https://github.com/exercism/rust) repository on GitHub is the home for all of the Rust exercises. If you have feedback about an exercise, or want to help implement new exercises, head over there and create an issue. Members of the rust track team are happy to help!
|
36
36
|
|
37
37
|
If you want to know more about Exercism, take a look at the [contribution guide](https://github.com/exercism/docs/blob/master/contributing-to-language-tracks/README.md).
|
38
38
|
|
@@ -65,7 +65,7 @@ haven't already, it will help you with organizing your files.
|
|
65
65
|
|
66
66
|
## Feedback, Issues, Pull Requests
|
67
67
|
|
68
|
-
The [exercism/rust](https://github.com/exercism/rust) repository on GitHub is the home for all of the Rust exercises. If you have feedback about an exercise, or want to help implement new exercises, head over there and create an issue. Members of the
|
68
|
+
The [exercism/rust](https://github.com/exercism/rust) repository on GitHub is the home for all of the Rust exercises. If you have feedback about an exercise, or want to help implement new exercises, head over there and create an issue. Members of the rust track team are happy to help!
|
69
69
|
|
70
70
|
If you want to know more about Exercism, take a look at the [contribution guide](https://github.com/exercism/docs/blob/master/contributing-to-language-tracks/README.md).
|
71
71
|
|
@@ -38,7 +38,7 @@ haven't already, it will help you with organizing your files.
|
|
38
38
|
|
39
39
|
## Feedback, Issues, Pull Requests
|
40
40
|
|
41
|
-
The [exercism/rust](https://github.com/exercism/rust) repository on GitHub is the home for all of the Rust exercises. If you have feedback about an exercise, or want to help implement new exercises, head over there and create an issue. Members of the
|
41
|
+
The [exercism/rust](https://github.com/exercism/rust) repository on GitHub is the home for all of the Rust exercises. If you have feedback about an exercise, or want to help implement new exercises, head over there and create an issue. Members of the rust track team are happy to help!
|
42
42
|
|
43
43
|
If you want to know more about Exercism, take a look at the [contribution guide](https://github.com/exercism/docs/blob/master/contributing-to-language-tracks/README.md).
|
44
44
|
|
@@ -41,7 +41,7 @@ haven't already, it will help you with organizing your files.
|
|
41
41
|
|
42
42
|
## Feedback, Issues, Pull Requests
|
43
43
|
|
44
|
-
The [exercism/rust](https://github.com/exercism/rust) repository on GitHub is the home for all of the Rust exercises. If you have feedback about an exercise, or want to help implement new exercises, head over there and create an issue. Members of the
|
44
|
+
The [exercism/rust](https://github.com/exercism/rust) repository on GitHub is the home for all of the Rust exercises. If you have feedback about an exercise, or want to help implement new exercises, head over there and create an issue. Members of the rust track team are happy to help!
|
45
45
|
|
46
46
|
If you want to know more about Exercism, take a look at the [contribution guide](https://github.com/exercism/docs/blob/master/contributing-to-language-tracks/README.md).
|
47
47
|
|
@@ -52,7 +52,7 @@ haven't already, it will help you with organizing your files.
|
|
52
52
|
|
53
53
|
## Feedback, Issues, Pull Requests
|
54
54
|
|
55
|
-
The [exercism/rust](https://github.com/exercism/rust) repository on GitHub is the home for all of the Rust exercises. If you have feedback about an exercise, or want to help implement new exercises, head over there and create an issue. Members of the
|
55
|
+
The [exercism/rust](https://github.com/exercism/rust) repository on GitHub is the home for all of the Rust exercises. If you have feedback about an exercise, or want to help implement new exercises, head over there and create an issue. Members of the rust track team are happy to help!
|
56
56
|
|
57
57
|
If you want to know more about Exercism, take a look at the [contribution guide](https://github.com/exercism/docs/blob/master/contributing-to-language-tracks/README.md).
|
58
58
|
|
@@ -41,7 +41,7 @@ haven't already, it will help you with organizing your files.
|
|
41
41
|
|
42
42
|
## Feedback, Issues, Pull Requests
|
43
43
|
|
44
|
-
The [exercism/rust](https://github.com/exercism/rust) repository on GitHub is the home for all of the Rust exercises. If you have feedback about an exercise, or want to help implement new exercises, head over there and create an issue. Members of the
|
44
|
+
The [exercism/rust](https://github.com/exercism/rust) repository on GitHub is the home for all of the Rust exercises. If you have feedback about an exercise, or want to help implement new exercises, head over there and create an issue. Members of the rust track team are happy to help!
|
45
45
|
|
46
46
|
If you want to know more about Exercism, take a look at the [contribution guide](https://github.com/exercism/docs/blob/master/contributing-to-language-tracks/README.md).
|
47
47
|
|
@@ -39,7 +39,7 @@ haven't already, it will help you with organizing your files.
|
|
39
39
|
|
40
40
|
## Feedback, Issues, Pull Requests
|
41
41
|
|
42
|
-
The [exercism/rust](https://github.com/exercism/rust) repository on GitHub is the home for all of the Rust exercises. If you have feedback about an exercise, or want to help implement new exercises, head over there and create an issue. Members of the
|
42
|
+
The [exercism/rust](https://github.com/exercism/rust) repository on GitHub is the home for all of the Rust exercises. If you have feedback about an exercise, or want to help implement new exercises, head over there and create an issue. Members of the rust track team are happy to help!
|
43
43
|
|
44
44
|
If you want to know more about Exercism, take a look at the [contribution guide](https://github.com/exercism/docs/blob/master/contributing-to-language-tracks/README.md).
|
45
45
|
|
@@ -53,7 +53,7 @@ haven't already, it will help you with organizing your files.
|
|
53
53
|
|
54
54
|
## Feedback, Issues, Pull Requests
|
55
55
|
|
56
|
-
The [exercism/rust](https://github.com/exercism/rust) repository on GitHub is the home for all of the Rust exercises. If you have feedback about an exercise, or want to help implement new exercises, head over there and create an issue. Members of the
|
56
|
+
The [exercism/rust](https://github.com/exercism/rust) repository on GitHub is the home for all of the Rust exercises. If you have feedback about an exercise, or want to help implement new exercises, head over there and create an issue. Members of the rust track team are happy to help!
|
57
57
|
|
58
58
|
If you want to know more about Exercism, take a look at the [contribution guide](https://github.com/exercism/docs/blob/master/contributing-to-language-tracks/README.md).
|
59
59
|
|
@@ -65,7 +65,7 @@ haven't already, it will help you with organizing your files.
|
|
65
65
|
|
66
66
|
## Feedback, Issues, Pull Requests
|
67
67
|
|
68
|
-
The [exercism/rust](https://github.com/exercism/rust) repository on GitHub is the home for all of the Rust exercises. If you have feedback about an exercise, or want to help implement new exercises, head over there and create an issue. Members of the
|
68
|
+
The [exercism/rust](https://github.com/exercism/rust) repository on GitHub is the home for all of the Rust exercises. If you have feedback about an exercise, or want to help implement new exercises, head over there and create an issue. Members of the rust track team are happy to help!
|
69
69
|
|
70
70
|
If you want to know more about Exercism, take a look at the [contribution guide](https://github.com/exercism/docs/blob/master/contributing-to-language-tracks/README.md).
|
71
71
|
|
@@ -40,7 +40,7 @@ haven't already, it will help you with organizing your files.
|
|
40
40
|
|
41
41
|
## Feedback, Issues, Pull Requests
|
42
42
|
|
43
|
-
The [exercism/rust](https://github.com/exercism/rust) repository on GitHub is the home for all of the Rust exercises. If you have feedback about an exercise, or want to help implement new exercises, head over there and create an issue. Members of the
|
43
|
+
The [exercism/rust](https://github.com/exercism/rust) repository on GitHub is the home for all of the Rust exercises. If you have feedback about an exercise, or want to help implement new exercises, head over there and create an issue. Members of the rust track team are happy to help!
|
44
44
|
|
45
45
|
If you want to know more about Exercism, take a look at the [contribution guide](https://github.com/exercism/docs/blob/master/contributing-to-language-tracks/README.md).
|
46
46
|
|
@@ -41,7 +41,7 @@ haven't already, it will help you with organizing your files.
|
|
41
41
|
|
42
42
|
## Feedback, Issues, Pull Requests
|
43
43
|
|
44
|
-
The [exercism/rust](https://github.com/exercism/rust) repository on GitHub is the home for all of the Rust exercises. If you have feedback about an exercise, or want to help implement new exercises, head over there and create an issue. Members of the
|
44
|
+
The [exercism/rust](https://github.com/exercism/rust) repository on GitHub is the home for all of the Rust exercises. If you have feedback about an exercise, or want to help implement new exercises, head over there and create an issue. Members of the rust track team are happy to help!
|
45
45
|
|
46
46
|
If you want to know more about Exercism, take a look at the [contribution guide](https://github.com/exercism/docs/blob/master/contributing-to-language-tracks/README.md).
|
47
47
|
|
@@ -50,7 +50,7 @@ haven't already, it will help you with organizing your files.
|
|
50
50
|
|
51
51
|
## Feedback, Issues, Pull Requests
|
52
52
|
|
53
|
-
The [exercism/rust](https://github.com/exercism/rust) repository on GitHub is the home for all of the Rust exercises. If you have feedback about an exercise, or want to help implement new exercises, head over there and create an issue. Members of the
|
53
|
+
The [exercism/rust](https://github.com/exercism/rust) repository on GitHub is the home for all of the Rust exercises. If you have feedback about an exercise, or want to help implement new exercises, head over there and create an issue. Members of the rust track team are happy to help!
|
54
54
|
|
55
55
|
If you want to know more about Exercism, take a look at the [contribution guide](https://github.com/exercism/docs/blob/master/contributing-to-language-tracks/README.md).
|
56
56
|
|
@@ -41,7 +41,7 @@ haven't already, it will help you with organizing your files.
|
|
41
41
|
|
42
42
|
## Feedback, Issues, Pull Requests
|
43
43
|
|
44
|
-
The [exercism/rust](https://github.com/exercism/rust) repository on GitHub is the home for all of the Rust exercises. If you have feedback about an exercise, or want to help implement new exercises, head over there and create an issue. Members of the
|
44
|
+
The [exercism/rust](https://github.com/exercism/rust) repository on GitHub is the home for all of the Rust exercises. If you have feedback about an exercise, or want to help implement new exercises, head over there and create an issue. Members of the rust track team are happy to help!
|
45
45
|
|
46
46
|
If you want to know more about Exercism, take a look at the [contribution guide](https://github.com/exercism/docs/blob/master/contributing-to-language-tracks/README.md).
|
47
47
|
|
@@ -39,7 +39,7 @@ haven't already, it will help you with organizing your files.
|
|
39
39
|
|
40
40
|
## Feedback, Issues, Pull Requests
|
41
41
|
|
42
|
-
The [exercism/rust](https://github.com/exercism/rust) repository on GitHub is the home for all of the Rust exercises. If you have feedback about an exercise, or want to help implement new exercises, head over there and create an issue. Members of the
|
42
|
+
The [exercism/rust](https://github.com/exercism/rust) repository on GitHub is the home for all of the Rust exercises. If you have feedback about an exercise, or want to help implement new exercises, head over there and create an issue. Members of the rust track team are happy to help!
|
43
43
|
|
44
44
|
If you want to know more about Exercism, take a look at the [contribution guide](https://github.com/exercism/docs/blob/master/contributing-to-language-tracks/README.md).
|
45
45
|
|
@@ -3,6 +3,18 @@ use std::collections::HashMap;
|
|
3
3
|
pub type CellID = usize;
|
4
4
|
pub type CallbackID = usize;
|
5
5
|
|
6
|
+
#[derive(Debug, PartialEq)]
|
7
|
+
pub enum SetValueError {
|
8
|
+
NonexistentCell,
|
9
|
+
ComputeCell,
|
10
|
+
}
|
11
|
+
|
12
|
+
#[derive(Debug, PartialEq)]
|
13
|
+
pub enum RemoveCallbackError {
|
14
|
+
NonexistentCell,
|
15
|
+
NonexistentCallback,
|
16
|
+
}
|
17
|
+
|
6
18
|
struct Cell<'a, T: Copy> {
|
7
19
|
value: T,
|
8
20
|
last_value: T,
|
@@ -46,11 +58,11 @@ impl <'a, T: Copy + PartialEq> Reactor<'a, T> {
|
|
46
58
|
self.cells.len() - 1
|
47
59
|
}
|
48
60
|
|
49
|
-
pub fn create_compute<F: Fn(&[T]) -> T + 'a>(&mut self, dependencies: &[CellID], compute_func: F) -> Result<CellID,
|
61
|
+
pub fn create_compute<F: Fn(&[T]) -> T + 'a>(&mut self, dependencies: &[CellID], compute_func: F) -> Result<CellID, CellID> {
|
50
62
|
// Check all dependencies' validity before modifying any of them,
|
51
63
|
// so that we don't perform an incorrect partial write.
|
52
|
-
if
|
53
|
-
return Err(
|
64
|
+
if let Some(&invalid) = dependencies.iter().find(|&dep| *dep >= self.cells.len()) {
|
65
|
+
return Err(invalid);
|
54
66
|
}
|
55
67
|
let new_id = self.cells.len();
|
56
68
|
for &id in dependencies {
|
@@ -66,16 +78,16 @@ impl <'a, T: Copy + PartialEq> Reactor<'a, T> {
|
|
66
78
|
self.cells.get(id).map(|c| c.value)
|
67
79
|
}
|
68
80
|
|
69
|
-
pub fn set_value(&mut self, id: CellID, new_value: T) -> Result<(),
|
81
|
+
pub fn set_value(&mut self, id: CellID, new_value: T) -> Result<(), SetValueError> {
|
70
82
|
match self.cells.get_mut(id) {
|
71
83
|
Some(c) => match c.cell_type {
|
72
84
|
CellType::Input => {
|
73
85
|
c.value = new_value;
|
74
86
|
Ok(c.dependents.clone())
|
75
87
|
},
|
76
|
-
CellType::Compute(_, _) => Err(
|
88
|
+
CellType::Compute(_, _) => Err(SetValueError::ComputeCell),
|
77
89
|
},
|
78
|
-
None => Err(
|
90
|
+
None => Err(SetValueError::NonexistentCell),
|
79
91
|
}.map(|deps| {
|
80
92
|
for &d in deps.iter() {
|
81
93
|
self.update_dependent(d);
|
@@ -88,24 +100,21 @@ impl <'a, T: Copy + PartialEq> Reactor<'a, T> {
|
|
88
100
|
})
|
89
101
|
}
|
90
102
|
|
91
|
-
pub fn add_callback<F: FnMut(T) -> () + 'a>(&mut self, id: CellID, callback: F) ->
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
},
|
98
|
-
None => Err("Can't add callback to nonexistent cell"),
|
99
|
-
}
|
103
|
+
pub fn add_callback<F: FnMut(T) -> () + 'a>(&mut self, id: CellID, callback: F) -> Option<CallbackID> {
|
104
|
+
self.cells.get_mut(id).map(|c| {
|
105
|
+
c.callbacks_issued += 1;
|
106
|
+
c.callbacks.insert(c.callbacks_issued, Box::new(callback));
|
107
|
+
c.callbacks_issued
|
108
|
+
})
|
100
109
|
}
|
101
110
|
|
102
|
-
pub fn remove_callback(&mut self, cell: CellID, callback: CallbackID) -> Result<(),
|
111
|
+
pub fn remove_callback(&mut self, cell: CellID, callback: CallbackID) -> Result<(), RemoveCallbackError> {
|
103
112
|
match self.cells.get_mut(cell) {
|
104
113
|
Some(c) => match c.callbacks.remove(&callback) {
|
105
114
|
Some(_) => Ok(()),
|
106
|
-
None => Err(
|
115
|
+
None => Err(RemoveCallbackError::NonexistentCallback),
|
107
116
|
},
|
108
|
-
None => Err(
|
117
|
+
None => Err(RemoveCallbackError::NonexistentCell),
|
109
118
|
}
|
110
119
|
}
|
111
120
|
|
@@ -5,6 +5,18 @@
|
|
5
5
|
pub type CellID = ();
|
6
6
|
pub type CallbackID = ();
|
7
7
|
|
8
|
+
#[derive(Debug, PartialEq)]
|
9
|
+
pub enum SetValueError {
|
10
|
+
NonexistentCell,
|
11
|
+
ComputeCell,
|
12
|
+
}
|
13
|
+
|
14
|
+
#[derive(Debug, PartialEq)]
|
15
|
+
pub enum RemoveCallbackError {
|
16
|
+
NonexistentCell,
|
17
|
+
NonexistentCallback,
|
18
|
+
}
|
19
|
+
|
8
20
|
pub struct Reactor<T> {
|
9
21
|
// Just so that the compiler doesn't complain about an unused type parameter.
|
10
22
|
// You probably want to delete this field.
|
@@ -28,12 +40,14 @@ impl <T: Copy + PartialEq> Reactor<T> {
|
|
28
40
|
// You do not need to reject compute functions that expect more arguments than there are
|
29
41
|
// dependencies (how would you check for this, anyway?).
|
30
42
|
//
|
31
|
-
//
|
43
|
+
// If any dependency doesn't exist, returns an Err with that nonexistent dependency.
|
44
|
+
// (If multiple dependencies do not exist, exactly which one is returned is not defined and
|
45
|
+
// will not be tested)
|
32
46
|
//
|
33
47
|
// Notice that there is no way to *remove* a cell.
|
34
48
|
// This means that you may assume, without checking, that if the dependencies exist at creation
|
35
49
|
// time they will continue to exist as long as the Reactor exists.
|
36
|
-
pub fn create_compute<F: Fn(&[T]) -> T>(&mut self, dependencies: &[CellID], compute_func: F) -> Result<CellID,
|
50
|
+
pub fn create_compute<F: Fn(&[T]) -> T>(&mut self, dependencies: &[CellID], compute_func: F) -> Result<CellID, CellID> {
|
37
51
|
unimplemented!()
|
38
52
|
}
|
39
53
|
|
@@ -50,20 +64,22 @@ impl <T: Copy + PartialEq> Reactor<T> {
|
|
50
64
|
|
51
65
|
// Sets the value of the specified input cell.
|
52
66
|
//
|
53
|
-
//
|
54
|
-
//
|
67
|
+
// Returns an Err if either:
|
68
|
+
// * the cell does not exist
|
69
|
+
// * the specified cell is a compute cell, since compute cells cannot have their values
|
70
|
+
// directly set.
|
55
71
|
//
|
56
72
|
// Similarly, you may wonder about `get_mut(&mut self, id: CellID) -> Option<&mut Cell>`, with
|
57
73
|
// a `set_value(&mut self, new_value: T)` method on `Cell`.
|
58
74
|
//
|
59
75
|
// As before, that turned out to add too much extra complexity.
|
60
|
-
pub fn set_value(&mut self, id: CellID, new_value: T) -> Result<(),
|
76
|
+
pub fn set_value(&mut self, id: CellID, new_value: T) -> Result<(), SetValueError> {
|
61
77
|
unimplemented!()
|
62
78
|
}
|
63
79
|
|
64
80
|
// Adds a callback to the specified compute cell.
|
65
81
|
//
|
66
|
-
//
|
82
|
+
// Returns the ID of the just-added callback, or None if the cell doesn't exist.
|
67
83
|
//
|
68
84
|
// Callbacks on input cells will not be tested.
|
69
85
|
//
|
@@ -73,17 +89,16 @@ impl <T: Copy + PartialEq> Reactor<T> {
|
|
73
89
|
// * Exactly once if the compute cell's value changed as a result of the set_value call.
|
74
90
|
// The value passed to the callback should be the final value of the compute cell after the
|
75
91
|
// set_value call.
|
76
|
-
pub fn add_callback<F: FnMut(T) -> ()>(&mut self, id: CellID, callback: F) ->
|
92
|
+
pub fn add_callback<F: FnMut(T) -> ()>(&mut self, id: CellID, callback: F) -> Option<CallbackID> {
|
77
93
|
unimplemented!()
|
78
94
|
}
|
79
95
|
|
80
96
|
// Removes the specified callback, using an ID returned from add_callback.
|
81
97
|
//
|
82
|
-
//
|
83
|
-
// does not exist.
|
98
|
+
// Returns an Err if either the cell or callback does not exist.
|
84
99
|
//
|
85
100
|
// A removed callback should no longer be called.
|
86
|
-
pub fn remove_callback(&mut self, cell: CellID, callback: CallbackID) -> Result<(),
|
101
|
+
pub fn remove_callback(&mut self, cell: CellID, callback: CallbackID) -> Result<(), RemoveCallbackError> {
|
87
102
|
unimplemented!()
|
88
103
|
}
|
89
104
|
}
|