This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Inspired by: | |
# http://learnyouahaskell.com/a-fistful-of-monads#walk-the-line | |
# Put simply, pierre is a tight rope walker. birds land on the left | |
# or right of his pole. If the difference is > 3 he falls off | |
ExUnit.start | |
defmodule WalkTheLine do | |
use ExUnit.Case |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Standings do | |
defrecord Competitor, surname: "", given_name: "", team: "", | |
total: 0, points: [] | |
@moduledoc """ | |
`Standings` analyzes a CSV file of results of an athletic competition | |
and produces a summary of their points towards a "grand champion" award. | |
Each row of the source CSV file consists of a competitor's name and | |
team affiliation (if any), followed by his placement at each of several |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule PrimeFactors do | |
@moduledoc """ | |
Inspired by Uncle Bob's algorithm: | |
http://butunclebob.com/ArticleS.UncleBob.ThePrimeFactorsKata | |
""" | |
@doc """ | |
Функция generate/1 получает целое число в качестве параметра | |
и возвращает все простые делители этого числа в виде списка. | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule RomanNumerals do | |
@moduledoc """ | |
Task definition: Create a function taking a positive integer as its parameter and | |
returning a string containing the Roman Numeral representation of that integer. | |
""" | |
def convert(number) do | |
convert(number, [[10,'X'], [9,'IX'], [5,'V'], [4,'IV'], [1,'I']]) | |
end |