Skip to content

Instantly share code, notes, and snippets.

@jisaacstone
Created January 9, 2016 22:51
Show Gist options
  • Save jisaacstone/1328aa353d8c8d52e51f to your computer and use it in GitHub Desktop.
Save jisaacstone/1328aa353d8c8d52e51f to your computer and use it in GitHub Desktop.
mode: :expand inspect examples :: first pass at implementation
[0]
IO.inspect [1,2,3], mode: :expand
[1,
2,
3]
[1]
IO.inspect {:foo, :bar}, mode: :expand
{:foo,
:bar}
[2]
IO.inspect 'catfish', mode: :expand
'catfish'
IO.inspect [0 | 'catfish'], mode: :expand
[0,
99,
97,
116,
102,
105,
115,
104]
[3]
IO.inspect "thistle", mode: :expand
"thistle"
[4]
IO.inspect <<0>> <> "thistle", mode: :expand
<<0, 116, 104, 105, 115, 116, 108, 101>>
[5]
IO.inspect <<0>> <> "thistle", mode: :expand, binaries: :as_strings
"\0thistle"
[6]
IO.inspect &inspect/2, mode: :expand
&Kernel.inspect/2
[7]
IO.inspect fn x -> x + 1 end, mode: :expand
#Function<6.54118792/1 in :erl_eval.expr/5>
[8]
IO.inspect %{:this => :that, :x => 7} , mode: :expand
%{this: :that
x: 7}
[9]
IO.inspect %{"this"=> :that, :x => 7} , mode: :expand
%{"this" => :that
:x => 7}
[10]
IO.inspect %{{:a, :b} => [1,2]}, mode: :expand
%{{:a,
:b} => [1,
2]}
[11]
IO.inspect [do: :a, else: :b], mode: :expand
[do: :a,
else: :b]
[12]
IO.inspect [:foo | [do: :a, else: :b]], mode: :expand
[:foo,
{:do,
:a},
{:else,
:b}]
[13]
IO.inspect %Foo{bar: 7, baz: :x}
%Foo{bar: 7,
baz: :x}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment