paiza.ioでelixir その174

# 概要
paiza.ioでelixirやってみた。
binary使ってみた。

# 参考にしたページ

https://qiita.com/kikuyuta/items/e200a6208013f38333de

# サンプルコード

```
104
|> IO.inspect

0b1101000
|> IO.inspect
0b01101000
|> IO.inspect
0b0110_1000
|> IO.inspect
0b01_101_000
|> IO.inspect
0o150
|> IO.inspect
0o0150
|> IO.inspect
0o000_150
|> IO.inspect
0x68
|> IO.inspect
0x068
|> IO.inspect
0x0000_0068
|> IO.inspect
x = 0x68
|> IO.inspect
x + 0x98
|> IO.inspect
<<104>>
|> IO.inspect
<<0b1101000>>
|> IO.inspect
<<0o150>>
|> IO.inspect
<<0x68>>
|> IO.inspect
<<104, 0b1100101, 0o154, 0x16c, 111>>
|> IO.inspect
<<77, 0b1100101, 0o162, 0x72, 121>>
|> IO.inspect
<<104+256>>
|> IO.inspect
<<104-256>>
|> IO.inspect
<<104+224>>
|> IO.inspect
<<104-288>>
|> IO.inspect
byte_size(<<104, 0b1100101, 0o154, 0x16c, 111>>)
|> IO.inspect
<<0b1101000::size(7)>>
|> IO.inspect
<<104::size(7)>>
|> IO.inspect
<<0o150::size(7)>>
|> IO.inspect
<<0x68::size(7)>>
|> IO.inspect
<<0x0000_0068::size(7)>>
|> IO.inspect
<<104::7>>
|> IO.inspect
<<0o150::7>>
|> IO.inspect
<<0x68::7>>
|> IO.inspect
<<0xd::4, 0b000::3>>
|> IO.inspect
<<0b110::3, 0o2::2, 0::2>>
|> IO.inspect
<<0b1101000>> == <<0b1101000::size(7)>>
|> IO.inspect
<<0b1101000>> == <<0b1101000::size(8)>>
|> IO.inspect
byte_size(<<0b1101000::size(7)>>)
|> IO.inspect
byte_size(<<0b1101000::size(8)>>)
|> IO.inspect
byte_size(<<0b1101000::size(7)>>) == byte_size(<<0b1101000::size(8)>>)
|> IO.inspect
inspect(104)
|> IO.inspect
inspect(104, base: :binary)
|> IO.inspect
inspect(104, base: :octal)
|> IO.inspect
inspect(104, base: :hex)
|> IO.inspect
inspect(0b1101000, base: :hex)
|> IO.inspect
inspect(0x68, base: :binary)
|> IO.inspect
inspect( <<0b110::3, 0o2::2, 0::2>>, base: :binary)
inspect( <<0b110::3, 0o2::2, 0::2>>, base: :hex)

0b1101000 |> inspect(base: :hex)

0x68 |> inspect(base: :binary)

<<0b110::3, 0o2::2, 0::2>> |> inspect(base: :binary)

x = <<0b1101000>>
|> IO.inspect
<<a::size(4), b::size(2), c::size(2)>> = x

IO.inspect(a, base: :binary)

IO.inspect(b, base: :binary)

IO.inspect(c, base: :binary)

<<a::4, b::2, c::2>> = x
|> IO.inspect
x = <<104, 0b1100101, 0o154, 0x16c, 111>>
|> IO.inspect
<<a::16, b::16, c::8>> = x
|> IO.inspect
IO.inspect(a, base: :hex)

IO.inspect(b, base: :hex)

IO.inspect(c, base: :hex)

<<p::8, rest::binary>> = x
|> IO.inspect
p
|> IO.inspect
rest
|> IO.inspect
<<102::integer-native, rest::binary>> = "foo"
|> IO.inspect
x = <<0b1100110, 0b1101111, 0b1101111>>
|> IO.inspect
<<102::integer-native, rest::binary>> = x
|> IO.inspect
<<102::native-integer, rest::binary>> = x
|> IO.inspect
<<102::unsigned-big-integer, rest::binary>> = x
|> IO.inspect
<<102::unsigned-big-integer-size(8), rest::binary>> = x
|> IO.inspect
<<102::unsigned-big-integer-8, rest::binary>> = x
|> IO.inspect
<<102::8-integer-big-unsigned, rest::binary>> = x
|> IO.inspect
<<102, rest::binary>> = x
|> IO.inspect
<<1.0::float>> |> inspect(base: :binary)

<<sign::1, exp::11, frac::52>> = <<1.0::float>>
|> IO.inspect
inspect(sign, base: :binary)

inspect(exp, base: :binary)

inspect(frac, base: :binary)

<<sign::1, exp::11, frac::52>> = <<-1.0::float>>
|> IO.inspect
inspect(sign, base: :binary)
|> IO.inspect
inspect(exp, base: :binary)
|> IO.inspect
inspect(frac, base: :binary)

<<sign::1, exp::11, frac::52>> = <<1/10::float>>
|> IO.inspect
inspect(sign, base: :binary)

inspect(exp, base: :binary)

inspect(frac, base: :binary)


```

# 実行結果
 
```
104
104
104
104
104
104
104
104
104
104
104
104
256
"h"
"h"
"h"
"h"
"hello"
"Merry"
"h"
"h"
"H"
"H"
5
<<104::size(7)>>
<<104::size(7)>>
<<104::size(7)>>
<<104::size(7)>>
<<104::size(7)>>
<<104::size(7)>>
<<104::size(7)>>
<<104::size(7)>>
<<104::size(7)>>
<<104::size(7)>>
<<104::size(7)>>
"h"
1
1
1
"104"
"0b1101000"
"0o150"
"0x68"
"0x68"
"0b1101000"
"h"
0b110
0b10
0b0
"h"
"hello"
"hello"
0x6865
0x6C6C
0x6F
"hello"
104
"ello"
"foo"
"foo"
"foo"
"foo"
"foo"
"foo"
"foo"
"foo"
"foo"
<<63, 240, 0, 0, 0, 0, 0, 0>>
<<191, 240, 0, 0, 0, 0, 0, 0>>
"0b1"
"0b1111111111"
<<63, 185, 153, 153, 153, 153, 153, 154>>
```

# 成果物

https://paiza.io/projects/fIT1TGqWD7s1uczbUxTzJg


以上。