Skip to content

Instantly share code, notes, and snippets.

@jisaacstone
Last active January 9, 2016 05:47
Show Gist options
  • Save jisaacstone/0cd8ca9c1056d22846c9 to your computer and use it in GitHub Desktop.
Save jisaacstone/0cd8ca9c1056d22846c9 to your computer and use it in GitHub Desktop.
pretty: :expanded implementation examples
[0]
inspect [1,2,3], pretty: :expanded
[1,
2,
3]
[1]
inspect {:foo, :bar}, pretty: :expanded
{:foo,
:bar}
[2]
inspect 'catfish', pretty: :expanded
'catfish'
inspect [0 | 'catfish'], pretty: :expanded
[0,
99,
97,
116,
102,
105,
115,
104]
[3]
inspect "thistle", pretty: :expanded
"thistle"
[4]
inspect <<0>> <> "thistle", pretty: :expanded
<<0,
116,
104,
105,
115,
116,
108,
101>>
[5]
inspect <<0>> <> "thistle", pretty: :expanded, binaries: :as_strings
"\0thistle"
[6]
inspect &inspect/2, pretty: :expanded
&Kernel.inspect/2
[7]
inspect fn x -> x + 1 end, pretty: :expanded
#Function<6.54118792/1 in :erl_eval.expr/5>
[8]
inspect %{:this => :that, :x => 7} , pretty: :expanded
%{this: :that
x: 7}
[9]
inspect %{"this"=> :that, :x => 7} , pretty: :expanded
%{"this" => :that
:x => 7}
[10]
inspect %{{:a, :b} => [1,2]}, pretty: :expanded
%{{:a,
:b}
=>[1,
2]}
[11]
inspect [do: :a, else: :b], pretty: :expanded
[do: :a,
else: :b]
[12]
inspect [:foo | [do: :a, else: :b]], pretty: :expanded
[:foo,
{:do,
:a},
{:else,
:b}]
[13]
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