Skip to content

Instantly share code, notes, and snippets.

View bytec4t's full-sized avatar

Daylen Wolaniuk bytec4t

View GitHub Profile

Keybase proof

I hereby claim:

  • I am sketchet on github.
  • I am sketchet (https://keybase.io/sketchet) on keybase.
  • I have a public key ASDPXud0jjA4I4HaqZJzT4htJ4-cwDaVgzVRY3uYwp0Zrgo

To claim this, I am signing this object:

@bytec4t
bytec4t / parse_input.exs
Last active April 19, 2017 22:46
Functions for parsing input into different types
defmodule Parse do
def stdin_to_integer() do
read_stdin |> String.to_integer
end
def stdin_to_string() do
read_stdin
end
defp read_stdin() do
@bytec4t
bytec4t / print.exs
Last active February 17, 2017 03:48
Printing lists using recursion with Elixir
defmodule Print do
# print the head of the list
def print_list([head | tail]) do
IO.puts(head)
print_list(tail)
end
# once list is empty this exectutes
def print_list([]) do
end
@bytec4t
bytec4t / read.exs
Last active April 20, 2017 19:39
Read all lines from STDIN
defmodule Read do
def read do
case IO.read(:stdio, :line) do
# what happens when done
:eof ->
:ok
# errors
{:error, reason} ->
IO.puts "Error: #{reason}"
# operations on each line