Skip to content

Commit

Permalink
commit alot
Browse files Browse the repository at this point in the history
  • Loading branch information
Vourhey committed Aug 28, 2018
1 parent d036eb0 commit 5858202
Show file tree
Hide file tree
Showing 205 changed files with 241 additions and 0 deletions.
Empty file modified .gitignore
100644 → 100755
Empty file.
Empty file modified README.md
100644 → 100755
Empty file.
Empty file modified haskell/accumulate/README.md
100644 → 100755
Empty file.
Empty file modified haskell/accumulate/accumulate.cabal
100644 → 100755
Empty file.
Empty file modified haskell/accumulate/package.yaml
100644 → 100755
Empty file.
Empty file modified haskell/accumulate/src/Accumulate.hs
100644 → 100755
Empty file.
Empty file modified haskell/accumulate/stack.yaml
100644 → 100755
Empty file.
Empty file modified haskell/accumulate/test/Tests.hs
100644 → 100755
Empty file.
Empty file modified haskell/acronym/README.md
100644 → 100755
Empty file.
Empty file modified haskell/acronym/acronym.cabal
100644 → 100755
Empty file.
Empty file modified haskell/acronym/package.yaml
100644 → 100755
Empty file.
Empty file modified haskell/acronym/src/Acronym.hs
100644 → 100755
Empty file.
Empty file modified haskell/acronym/stack.yaml
100644 → 100755
Empty file.
Empty file modified haskell/acronym/test/Tests.hs
100644 → 100755
Empty file.
Empty file modified haskell/anagram/README.md
100644 → 100755
Empty file.
Empty file modified haskell/anagram/anagram.cabal
100644 → 100755
Empty file.
Empty file modified haskell/anagram/package.yaml
100644 → 100755
Empty file.
Empty file modified haskell/anagram/src/Anagram.hs
100644 → 100755
Empty file.
Empty file modified haskell/anagram/stack.yaml
100644 → 100755
Empty file.
Empty file modified haskell/anagram/test/Tests.hs
100644 → 100755
Empty file.
Empty file modified haskell/beer-song/README.md
100644 → 100755
Empty file.
Empty file modified haskell/beer-song/beer-song.cabal
100644 → 100755
Empty file.
Empty file modified haskell/beer-song/package.yaml
100644 → 100755
Empty file.
Empty file modified haskell/beer-song/src/Beer.hs
100644 → 100755
Empty file.
Empty file modified haskell/beer-song/stack.yaml
100644 → 100755
Empty file.
Empty file modified haskell/beer-song/test/Tests.hs
100644 → 100755
Empty file.
Empty file modified haskell/bob/README.md
100644 → 100755
Empty file.
Empty file modified haskell/bob/bob.cabal
100644 → 100755
Empty file.
Empty file modified haskell/bob/package.yaml
100644 → 100755
Empty file.
Empty file modified haskell/bob/src/Bob.hs
100644 → 100755
Empty file.
Empty file modified haskell/bob/stack.yaml
100644 → 100755
Empty file.
Empty file modified haskell/bob/test/Tests.hs
100644 → 100755
Empty file.
Empty file modified haskell/collatz-conjecture/README.md
100644 → 100755
Empty file.
Empty file modified haskell/collatz-conjecture/collatz-conjecture.cabal
100644 → 100755
Empty file.
Empty file modified haskell/collatz-conjecture/package.yaml
100644 → 100755
Empty file.
Empty file modified haskell/collatz-conjecture/src/CollatzConjecture.hs
100644 → 100755
Empty file.
Empty file modified haskell/collatz-conjecture/stack.yaml
100644 → 100755
Empty file.
Empty file modified haskell/collatz-conjecture/test/Tests.hs
100644 → 100755
Empty file.
Empty file modified haskell/complex-numbers/README.md
100644 → 100755
Empty file.
Empty file modified haskell/complex-numbers/complex-numbers.cabal
100644 → 100755
Empty file.
Empty file modified haskell/complex-numbers/package.yaml
100644 → 100755
Empty file.
Empty file modified haskell/complex-numbers/src/ComplexNumbers.hs
100644 → 100755
Empty file.
Empty file modified haskell/complex-numbers/stack.yaml
100644 → 100755
Empty file.
Empty file modified haskell/complex-numbers/test/Tests.hs
100644 → 100755
Empty file.
Empty file modified haskell/diamond/README.md
100644 → 100755
Empty file.
Empty file modified haskell/diamond/diamond.cabal
100644 → 100755
Empty file.
Empty file modified haskell/diamond/package.yaml
100644 → 100755
Empty file.
Empty file modified haskell/diamond/src/Diamond.hs
100644 → 100755
Empty file.
Empty file modified haskell/diamond/stack.yaml
100644 → 100755
Empty file.
Empty file modified haskell/diamond/test/Tests.hs
100644 → 100755
Empty file.
Empty file modified haskell/difference-of-squares/README.md
100644 → 100755
Empty file.
Empty file modified haskell/difference-of-squares/difference-of-squares.cabal
100644 → 100755
Empty file.
Empty file modified haskell/difference-of-squares/package.yaml
100644 → 100755
Empty file.
Empty file modified haskell/difference-of-squares/src/Squares.hs
100644 → 100755
Empty file.
Empty file modified haskell/difference-of-squares/stack.yaml
100644 → 100755
Empty file.
Empty file modified haskell/difference-of-squares/test/Tests.hs
100644 → 100755
Empty file.
Empty file modified haskell/etl/README.md
100644 → 100755
Empty file.
Empty file modified haskell/etl/etl.cabal
100644 → 100755
Empty file.
Empty file modified haskell/etl/package.yaml
100644 → 100755
Empty file.
Empty file modified haskell/etl/src/ETL.hs
100644 → 100755
Empty file.
Empty file modified haskell/etl/stack.yaml
100644 → 100755
Empty file.
Empty file modified haskell/etl/test/Tests.hs
100644 → 100755
Empty file.
Empty file modified haskell/grains/README.md
100644 → 100755
Empty file.
Empty file modified haskell/grains/grains.cabal
100644 → 100755
Empty file.
Empty file modified haskell/grains/package.yaml
100644 → 100755
Empty file.
Empty file modified haskell/grains/src/Grains.hs
100644 → 100755
Empty file.
Empty file modified haskell/grains/stack.yaml
100644 → 100755
Empty file.
Empty file modified haskell/grains/test/Tests.hs
100644 → 100755
Empty file.
Empty file modified haskell/hamming/README.md
100644 → 100755
Empty file.
Empty file modified haskell/hamming/hamming.cabal
100644 → 100755
Empty file.
Empty file modified haskell/hamming/package.yaml
100644 → 100755
Empty file.
Empty file modified haskell/hamming/src/Hamming.hs
100644 → 100755
Empty file.
Empty file modified haskell/hamming/stack.yaml
100644 → 100755
Empty file.
Empty file modified haskell/hamming/test/Tests.hs
100644 → 100755
Empty file.
Empty file modified haskell/hello-world/README.md
100644 → 100755
Empty file.
Empty file modified haskell/hello-world/hello-world.cabal
100644 → 100755
Empty file.
Empty file modified haskell/hello-world/package.yaml
100644 → 100755
Empty file.
Empty file modified haskell/hello-world/src/HelloWorld.hs
100644 → 100755
Empty file.
Empty file modified haskell/hello-world/stack.yaml
100644 → 100755
Empty file.
Empty file modified haskell/hello-world/test/Tests.hs
100644 → 100755
Empty file.
Empty file modified haskell/isogram/README.md
100644 → 100755
Empty file.
Empty file modified haskell/isogram/isogram.cabal
100644 → 100755
Empty file.
Empty file modified haskell/isogram/package.yaml
100644 → 100755
Empty file.
Empty file modified haskell/isogram/src/Isogram.hs
100644 → 100755
Empty file.
Empty file modified haskell/isogram/stack.yaml
100644 → 100755
Empty file.
Empty file modified haskell/isogram/test/Tests.hs
100644 → 100755
Empty file.
Empty file modified haskell/kindergarten-garden/README.md
100644 → 100755
Empty file.
Empty file modified haskell/kindergarten-garden/kindergarten-garden.cabal
100644 → 100755
Empty file.
Empty file modified haskell/kindergarten-garden/package.yaml
100644 → 100755
Empty file.
Empty file modified haskell/kindergarten-garden/src/Garden.hs
100644 → 100755
Empty file.
Empty file modified haskell/kindergarten-garden/stack.yaml
100644 → 100755
Empty file.
Empty file modified haskell/kindergarten-garden/test/Tests.hs
100644 → 100755
Empty file.
Empty file modified haskell/leap/README.md
100644 → 100755
Empty file.
Empty file modified haskell/leap/leap.cabal
100644 → 100755
Empty file.
Empty file modified haskell/leap/package.yaml
100644 → 100755
Empty file.
Empty file modified haskell/leap/src/LeapYear.hs
100644 → 100755
Empty file.
Empty file modified haskell/leap/stack.yaml
100644 → 100755
Empty file.
Empty file modified haskell/leap/test/Tests.hs
100644 → 100755
Empty file.
Empty file modified haskell/list-ops/README.md
100644 → 100755
Empty file.
Empty file modified haskell/list-ops/list-ops.cabal
100644 → 100755
Empty file.
Empty file modified haskell/list-ops/package.yaml
100644 → 100755
Empty file.
Empty file modified haskell/list-ops/src/ListOps.hs
100644 → 100755
Empty file.
Empty file modified haskell/list-ops/stack.yaml
100644 → 100755
Empty file.
Empty file modified haskell/list-ops/test/Tests.hs
100644 → 100755
Empty file.
Empty file modified haskell/meetup/README.md
100644 → 100755
Empty file.
Empty file modified haskell/meetup/meetup.cabal
100644 → 100755
Empty file.
Empty file modified haskell/meetup/package.yaml
100644 → 100755
Empty file.
Empty file modified haskell/meetup/src/Meetup.hs
100644 → 100755
Empty file.
Empty file modified haskell/meetup/stack.yaml
100644 → 100755
Empty file.
Empty file modified haskell/meetup/test/Tests.hs
100644 → 100755
Empty file.
Empty file modified haskell/nucleotide-count/README.md
100644 → 100755
Empty file.
Empty file modified haskell/nucleotide-count/nucleotide-count.cabal
100644 → 100755
Empty file.
Empty file modified haskell/nucleotide-count/package.yaml
100644 → 100755
Empty file.
Empty file modified haskell/nucleotide-count/src/DNA.hs
100644 → 100755
Empty file.
Empty file modified haskell/nucleotide-count/stack.yaml
100644 → 100755
Empty file.
Empty file modified haskell/nucleotide-count/test/Tests.hs
100644 → 100755
Empty file.
Empty file modified haskell/pangram/README.md
100644 → 100755
Empty file.
Empty file modified haskell/pangram/package.yaml
100644 → 100755
Empty file.
Empty file modified haskell/pangram/pangram.cabal
100644 → 100755
Empty file.
Empty file modified haskell/pangram/src/Pangram.hs
100644 → 100755
Empty file.
Empty file modified haskell/pangram/stack.yaml
100644 → 100755
Empty file.
Empty file modified haskell/pangram/test/Tests.hs
100644 → 100755
Empty file.
Empty file modified haskell/perfect-numbers/README.md
100644 → 100755
Empty file.
Empty file modified haskell/perfect-numbers/package.yaml
100644 → 100755
Empty file.
Empty file modified haskell/perfect-numbers/perfect-numbers.cabal
100644 → 100755
Empty file.
Empty file modified haskell/perfect-numbers/src/PerfectNumbers.hs
100644 → 100755
Empty file.
Empty file modified haskell/perfect-numbers/stack.yaml
100644 → 100755
Empty file.
Empty file modified haskell/perfect-numbers/test/Tests.hs
100644 → 100755
Empty file.
Empty file modified haskell/protein-translation/README.md
100644 → 100755
Empty file.
Empty file modified haskell/protein-translation/package.yaml
100644 → 100755
Empty file.
Empty file modified haskell/protein-translation/protein-translation.cabal
100644 → 100755
Empty file.
Empty file modified haskell/protein-translation/src/ProteinTranslation.hs
100644 → 100755
Empty file.
Empty file modified haskell/protein-translation/stack.yaml
100644 → 100755
Empty file.
Empty file modified haskell/protein-translation/test/Tests.hs
100644 → 100755
Empty file.
Empty file modified haskell/raindrops/README.md
100644 → 100755
Empty file.
Empty file modified haskell/raindrops/package.yaml
100644 → 100755
Empty file.
Empty file modified haskell/raindrops/raindrops.cabal
100644 → 100755
Empty file.
Empty file modified haskell/raindrops/src/Raindrops.hs
100644 → 100755
Empty file.
Empty file modified haskell/raindrops/stack.yaml
100644 → 100755
Empty file.
Empty file modified haskell/raindrops/test/Tests.hs
100644 → 100755
Empty file.
Empty file modified haskell/rna-transcription/README.md
100644 → 100755
Empty file.
Empty file modified haskell/rna-transcription/package.yaml
100644 → 100755
Empty file.
Empty file modified haskell/rna-transcription/rna-transcription.cabal
100644 → 100755
Empty file.
Empty file modified haskell/rna-transcription/src/DNA.hs
100644 → 100755
Empty file.
Empty file modified haskell/rna-transcription/stack.yaml
100644 → 100755
Empty file.
Empty file modified haskell/rna-transcription/test/Tests.hs
100644 → 100755
Empty file.
Empty file modified haskell/robot-simulator/README.md
100644 → 100755
Empty file.
Empty file modified haskell/robot-simulator/package.yaml
100644 → 100755
Empty file.
Empty file modified haskell/robot-simulator/robot-simulator.cabal
100644 → 100755
Empty file.
Empty file modified haskell/robot-simulator/src/Robot.hs
100644 → 100755
Empty file.
Empty file modified haskell/robot-simulator/stack.yaml
100644 → 100755
Empty file.
Empty file modified haskell/robot-simulator/test/Tests.hs
100644 → 100755
Empty file.
112 changes: 112 additions & 0 deletions haskell/roman-numerals/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
# Roman Numerals

Write a function to convert from normal numbers to Roman Numerals.

The Romans were a clever bunch. They conquered most of Europe and ruled
it for hundreds of years. They invented concrete and straight roads and
even bikinis. One thing they never discovered though was the number
zero. This made writing and dating extensive histories of their exploits
slightly more challenging, but the system of numbers they came up with
is still in use today. For example the BBC uses Roman numerals to date
their programmes.

The Romans wrote numbers using letters - I, V, X, L, C, D, M. (notice
these letters have lots of straight lines and are hence easy to hack
into stone tablets).

```text
1 => I
10 => X
7 => VII
```

There is no need to be able to convert numbers larger than about 3000.
(The Romans themselves didn't tend to go any higher)

Wikipedia says: Modern Roman numerals ... are written by expressing each
digit separately starting with the left most digit and skipping any
digit with a value of zero.

To see this in practice, consider the example of 1990.

In Roman numerals 1990 is MCMXC:

1000=M
900=CM
90=XC

2008 is written as MMVIII:

2000=MM
8=VIII

See also: http://www.novaroma.org/via_romana/numbers.html

## Hints

To complete this exercise you need to implement the function `numerals`,
that *maybe* converts a number to a *string* representing a roman numeral.

Your function is expected to, at least, convert numbers up to 3000,
but is up to you to decide how far you want to go.



## Getting Started

For installation and learning resources, refer to the
[exercism help page](http://exercism.io/languages/haskell).

## Running the tests

To run the test suite, execute the following command:

```bash
stack test
```

#### If you get an error message like this...

```
No .cabal file found in directory
```

You are probably running an old stack version and need
to upgrade it.

#### Otherwise, if you get an error message like this...

```
No compiler found, expected minor version match with...
Try running "stack setup" to install the correct GHC...
```

Just do as it says and it will download and install
the correct compiler version:

```bash
stack setup
```

## Running *GHCi*

If you want to play with your solution in GHCi, just run the command:

```bash
stack ghci
```

## Feedback, Issues, Pull Requests

The [exercism/haskell](https://github.com/exercism/haskell) repository on
GitHub is the home for all of the Haskell exercises.

If you have feedback about an exercise, or want to help implementing a new
one, head over there and create an issue. We'll do our best to help you!

## Source

The Roman Numeral Kata [http://codingdojo.org/cgi-bin/index.pl?KataRomanNumerals](http://codingdojo.org/cgi-bin/index.pl?KataRomanNumerals)

## Submitting Incomplete Solutions
It's possible to submit an incomplete solution so you can see how others have completed the exercise.
20 changes: 20 additions & 0 deletions haskell/roman-numerals/package.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: roman-numerals
version: 1.2.0.5

dependencies:
- base

library:
exposed-modules: Roman
source-dirs: src
# dependencies:
# - foo # List here the packages you
# - bar # want to use in your solution.

tests:
test:
main: Tests.hs
source-dirs: test
dependencies:
- roman-numerals
- hspec
4 changes: 4 additions & 0 deletions haskell/roman-numerals/src/Roman.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module Roman (numerals) where

numerals :: Integer -> Maybe String
numerals n = error "You need to implement this function."
1 change: 1 addition & 0 deletions haskell/roman-numerals/stack.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
resolver: lts-11.1
104 changes: 104 additions & 0 deletions haskell/roman-numerals/test/Tests.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
{-# OPTIONS_GHC -fno-warn-type-defaults #-}
{-# LANGUAGE RecordWildCards #-}

import Data.Foldable (for_)
import Test.Hspec (Spec, describe, it, shouldBe)
import Test.Hspec.Runner (configFastFail, defaultConfig, hspecWith)

import Roman (numerals)

main :: IO ()
main = hspecWith defaultConfig {configFastFail = True} specs

specs :: Spec
specs = describe "numerals" $ for_ cases test
where

test Case{..} = it explanation assertion
where
explanation = show number ++ ": " ++ description
assertion = numerals (fromIntegral number) `shouldBe` expected

data Case = Case { description :: String
, number :: Integer
, expected :: Maybe String
}

cases :: [Case]
cases = [ Case { description = "1 is a single I"
, number = 1
, expected = Just "I"
}
, Case { description = "2 is two I's"
, number = 2
, expected = Just "II"
}
, Case { description = "3 is three I's"
, number = 3
, expected = Just "III"
}
, Case { description = "4, being 5 - 1, is IV"
, number = 4
, expected = Just "IV"
}
, Case { description = "5 is a single V"
, number = 5
, expected = Just "V"
}
, Case { description = "6, being 5 + 1, is VI"
, number = 6
, expected = Just "VI"
}
, Case { description = "9, being 10 - 1, is IX"
, number = 9
, expected = Just "IX"
}
, Case { description = "20 is two X's"
, number = 27
, expected = Just "XXVII"
}
, Case { description = "48 is not 50 - 2 but rather 40 + 8"
, number = 48
, expected = Just "XLVIII"
}
, Case { description = "49 is not 40 + 5 + 4 but rather 50 - 10 + 10 - 1"
, number = 49
, expected = Just "XLIX"
}
, Case { description = "50 is a single L"
, number = 59
, expected = Just "LIX"
}
, Case { description = "90, being 100 - 10, is XC"
, number = 93
, expected = Just "XCIII"
}
, Case { description = "100 is a single C"
, number = 141
, expected = Just "CXLI"
}
, Case { description = "60, being 50 + 10, is LX"
, number = 163
, expected = Just "CLXIII"
}
, Case { description = "400, being 500 - 100, is CD"
, number = 402
, expected = Just "CDII"
}
, Case { description = "500 is a single D"
, number = 575
, expected = Just "DLXXV"
}
, Case { description = "900, being 1000 - 100, is CM"
, number = 911
, expected = Just "CMXI"
}
, Case { description = "1000 is a single M"
, number = 1024
, expected = Just "MXXIV"
}
, Case { description = "3000 is three M's"
, number = 3000
, expected = Just "MMM"
}
]
Empty file modified haskell/scrabble-score/README.md
100644 → 100755
Empty file.
Empty file modified haskell/scrabble-score/package.yaml
100644 → 100755
Empty file.
Empty file modified haskell/scrabble-score/scrabble-score.cabal
100644 → 100755
Empty file.
Empty file modified haskell/scrabble-score/src/Scrabble.hs
100644 → 100755
Empty file.
Empty file modified haskell/scrabble-score/stack.yaml
100644 → 100755
Empty file.
Empty file modified haskell/scrabble-score/test/Tests.hs
100644 → 100755
Empty file.
Empty file modified haskell/secret-handshake/README.md
100644 → 100755
Empty file.
Empty file modified haskell/secret-handshake/package.yaml
100644 → 100755
Empty file.
Empty file modified haskell/secret-handshake/secret-handshake.cabal
100644 → 100755
Empty file.
Empty file modified haskell/secret-handshake/src/SecretHandshake.hs
100644 → 100755
Empty file.
Empty file modified haskell/secret-handshake/stack.yaml
100644 → 100755
Empty file.
Empty file modified haskell/secret-handshake/test/Tests.hs
100644 → 100755
Empty file.
Empty file modified haskell/simple-linked-list/README.md
100644 → 100755
Empty file.
Empty file modified haskell/simple-linked-list/package.yaml
100644 → 100755
Empty file.
Empty file modified haskell/simple-linked-list/simple-linked-list.cabal
100644 → 100755
Empty file.
Empty file modified haskell/simple-linked-list/src/LinkedList.hs
100644 → 100755
Empty file.
Empty file modified haskell/simple-linked-list/stack.yaml
100644 → 100755
Empty file.
Empty file modified haskell/simple-linked-list/test/Tests.hs
100644 → 100755
Empty file.
Empty file modified haskell/space-age/README.md
100644 → 100755
Empty file.
Empty file modified haskell/space-age/package.yaml
100644 → 100755
Empty file.
Empty file modified haskell/space-age/space-age.cabal
100644 → 100755
Empty file.
Empty file modified haskell/space-age/src/SpaceAge.hs
100644 → 100755
Empty file.
Empty file modified haskell/space-age/stack.yaml
100644 → 100755
Empty file.
Empty file modified haskell/space-age/test/Tests.hs
100644 → 100755
Empty file.
Empty file modified haskell/strain/README.md
100644 → 100755
Empty file.
Empty file modified haskell/strain/package.yaml
100644 → 100755
Empty file.
Empty file modified haskell/strain/src/Strain.hs
100644 → 100755
Empty file.
Empty file modified haskell/strain/stack.yaml
100644 → 100755
Empty file.
Empty file modified haskell/strain/strain.cabal
100644 → 100755
Empty file.
Empty file modified haskell/strain/test/Tests.hs
100644 → 100755
Empty file.
Empty file modified haskell/sum-of-multiples/README.md
100644 → 100755
Empty file.
Empty file modified haskell/sum-of-multiples/package.yaml
100644 → 100755
Empty file.
Empty file modified haskell/sum-of-multiples/src/SumOfMultiples.hs
100644 → 100755
Empty file.
Empty file modified haskell/sum-of-multiples/stack.yaml
100644 → 100755
Empty file.
Empty file modified haskell/sum-of-multiples/sum-of-multiples.cabal
100644 → 100755
Empty file.
Empty file modified haskell/sum-of-multiples/test/Tests.hs
100644 → 100755
Empty file.
Empty file modified haskell/triangle/README.md
100644 → 100755
Empty file.
Empty file modified haskell/triangle/package.yaml
100644 → 100755
Empty file.
Empty file modified haskell/triangle/src/Triangle.hs
100644 → 100755
Empty file.
Empty file modified haskell/triangle/stack.yaml
100644 → 100755
Empty file.
Empty file modified haskell/triangle/test/Tests.hs
100644 → 100755
Empty file.
Empty file modified haskell/triangle/triangle.cabal
100644 → 100755
Empty file.
Empty file modified haskell/twelve-days/README.md
100644 → 100755
Empty file.
Empty file modified haskell/twelve-days/package.yaml
100644 → 100755
Empty file.
Empty file modified haskell/twelve-days/src/TwelveDays.hs
100644 → 100755
Empty file.
Empty file modified haskell/twelve-days/stack.yaml
100644 → 100755
Empty file.
Empty file modified haskell/twelve-days/test/Tests.hs
100644 → 100755
Empty file.
Empty file modified haskell/twelve-days/twelve-days.cabal
100644 → 100755
Empty file.

0 comments on commit 5858202

Please sign in to comment.