Skip to content

Instantly share code, notes, and snippets.

View AlbertMoscow's full-sized avatar
🏠
Working from home

Albert AlbertMoscow

🏠
Working from home
View GitHub Profile
@AlbertMoscow
AlbertMoscow / roman_numerals.exs
Last active October 26, 2019 05:21
Roman Numerals kata implemented in elixir
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
@AlbertMoscow
AlbertMoscow / prime_factors.exs
Created July 10, 2013 09:50
The Prime Factors Kata implemented in elixir
defmodule PrimeFactors do
@moduledoc """
Inspired by Uncle Bob's algorithm:
http://butunclebob.com/ArticleS.UncleBob.ThePrimeFactorsKata
"""
@doc """
Функция generate/1 получает целое число в качестве параметра
и возвращает все простые делители этого числа в виде списка.
"""
@AlbertMoscow
AlbertMoscow / grand_champion.exs
Created June 16, 2013 09:27
Grand Champion Standings: A Short Elixir Program by J David Eisenberg Adopted from here: http://langintro.com/elixir/article1/
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
@AlbertMoscow
AlbertMoscow / pierre.exs
Last active December 18, 2015 05:39 — forked from mattyw/pierre.exs
# 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