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
# Numbers | |
0b0101011 | |
1234 ; 0x1A ; 0xbeef ; 0763 | |
3.14 ; 5.0e21 ; 0.5e-12 | |
100_000_000 | |
# Characters | |
?a ; ?1 ; ?\n ; ?\s ; ?\c ; ? ; ?, | |
?\x{12} ; ?\x{abcd} | |
?\x34 ; ?\xf |
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
=ERROR REPORT==== 4-Jun-2014::17:08:31 === | |
** Generic server <0.93.0> terminating | |
** Last message in was {'$gen_cast',{data,<<">end< one\n>end< two\n">>}} | |
** When Server state == {state,nil,[],{<0.92.0>,#Ref<0.0.0.1449>}} | |
** Reason for termination == | |
** {bad_cast,{data,<<">end< one\n>end< two\n">>}} | |
marking agent as done | |
1) test spawn streams (PorcelainTest.SimpleTest) |
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
λ mix test | |
1) test the truth (TestyTest) | |
test/testy_test.exs:4 | |
Assertion with == failed | |
code: 1 + 1 == 3 | |
lhs: 2 | |
rhs: 3 | |
stacktrace: | |
test/testy_test.exs:5 |
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
iex(5)> Ports.open_port "cat", ["1"], "hello" | |
** (ArgumentError) argument error | |
:erlang.open_port({:spawn, "cat"}, [:stream, :binary, {:args, ["1"]}, :use_stdio, :stderr_to_stdout, :exit_status]) | |
(elixir) lib/port.ex:10: Port.open/2 | |
port.ex:3: Ports.open_port/ |
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
Receive simple | |
simple eof | |
sending command | |
sent command | |
Receive wrapped | |
sh: /Users/stdout-wrap: No such file or directory | |
sh: line 0: exec: /Users/stdout-wrap: cannot execute: No such file or directory | |
{:wtf, "wrapped", {#Port<0.3129>, {:exit_status, 126}}} | |
Receive wrapped | |
wrapped eof |
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
λ cat test.exs | |
#!/usr/local/bin/elixir | |
λ od test.exs | |
0000000 020443 072457 071163 066057 061557 066141 061057 067151 | |
0000020 062457 064554 064570 005162 | |
0000030 |
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 Bag do | |
defstruct store: %{} | |
def new do | |
%Bag{} | |
end | |
def put(%Bag{store: store}, thing) do | |
%Bag{store: Map.update(store, thing, 1, &( &1 + 1))} | |
end |
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
iex(3)> """abc | |
...(3)> bcd""" | |
...(3)> """ | |
...(3)> """ | |
...(3)> """ | |
...(3)> |
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
# attr.exs | |
# using module attributes as compile-time constants | |
defmodule M do | |
@constant 13 | |
def a, do: @constant | |
@constant 44 |
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 Beamie.Store.RiakHTTP do | |
def put(bucket, key, value) do | |
IO.puts "storing value #{inspect value} with key #{key} in bucket '#{bucket}'" | |
put_req(bucket, key, value) | |
end | |
def get(bucket, key) do | |
IO.puts "retrieving value for key #{key} from bucket '#{bucket}'" | |
get_req(bucket, key) | |
end |