I hereby claim:
- I am supersimple on github.
- I am supersimple (https://keybase.io/supersimple) on keybase.
- I have a public key ASCtr8jm-HKtUdu96MUKexbw-UjojwK3mdljan-v1bcK6Ao
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
iex> Version.match?("2.0.0", "> 1.0.0") | |
true | |
iex> Version.match?("2.0.0", "== 1.0.0") | |
false |
iex(17)> {:ok, requirement} = Version.parse_requirement("== 2.0.1") | |
{:ok, #Version.Requirement<== 2.0.1>} |
iex(9)> v = Version.parse!("1.0.0-alpha.3+20130417140000") | |
#Version<1.0.0-alpha.3+20130417140000> | |
iex(10)> v.build | |
"20130417140000" | |
iex(11)> v.pre | |
["alpha", 3] | |
iex(12)> v.patch |
iex(4)> Version.parse!("2.3.4") | |
#Version<2.3.4> | |
iex(5)> Version.parse!("0.09") | |
** (Version.InvalidVersionError) invalid version: "0.09" |
if Version.compare(System.version(), "1.4.0") == :lt do | |
def enum_split_with(enum, fun), do: Enum.partition(enum, fun) | |
else | |
def enum_split_with(enum, fun), do: Enum.split_with(enum, fun) | |
end |
# This prints out the nth member of the sequence | |
def fib(n) | |
last_two = [0,1] | |
3.upto(n) do | |
last_two = last_two[1], last_two.inject(:+) | |
end | |
puts last_two.last | |
end |
defmodule Wordcount do | |
@moduledoc """ | |
Documentation for Wordcount. | |
""" | |
@spec count(String.t) :: map | |
def count(sentence) do | |
sentence | |
|> String.downcase | |
|> String.replace(~r/[,\.&:!@\$%\^]+/, "") |
defmodule Day do | |
@spec count_valid() :: number() | |
def count_valid do | |
pwds = String.split(input(), "\n") | |
Enum.count(pwds, fn(ln) -> line_valid?(ln) end) | |
end | |
@spec line_valid?(string) :: boolean() | |
defp line_valid?(line) do |