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
Verifying that "pedrosnk.id" is my Blockstack ID. https://onename.com/pedrosnk |
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 Balance do | |
def balance str do | |
balance(str, 0) | |
end | |
defp balance str, parenthesis_count do | |
if String.length(str) == 0 do | |
parenthesis_count == 0 | |
else if parenthesis_count < 0 do | |
false | |
else |
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 GuessingGameUI do | |
IO.puts "Elixir Guessing Game\n\n\n" | |
IO.puts "========================\n" | |
random_number = :random.uniform(10) | |
user_input = GuessingGame.convert_user_input(IO.gets('Enter your guess: ')) | |
{status, message} = GuessingGame.check_user_input(user_input) |
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
set ts=2 sw=2 sts=2 | |
"Expand column 80:w | |
"let &colorcolumn=80 | |
let &colorcolumn=join(range(81,999),",") | |
"Hilight extra whitespace | |
highlight ExtraWhitespace ctermbg=red guibg=red | |
match ExtraWhitespace /\s\+$/ |
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
% First Code Kata from http://projecteuler.net/problem=1 | |
% If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. | |
% Find the sum of all the multiples of 3 or 5 below 1000. | |
-module(problem1). | |
-export([populate_list/1]). | |
-export([go/0]). | |
populate_list(1) -> []; | |
populate_list(Number) when (Number rem 3 == 0) or (Number rem 5 == 0) -> |