Powered by AppSignal & Oban Pro
Would you like to see your link here? Contact us

Untitled notebook

base_sigil.livemd

Untitled notebook

Mix.install([
  # {:hexdump, "~> 0.1.2"}
  {:hexdump, path: "/home/kuku/Projects/hexdump"}
])

Hexdump.on()

Section

defmodule BaseSigils do
  defmacro sigil_OX(string, []) do
    {val, []} =
      quote do
        unquote(string)
        |> String.split([" ", "0x"])
        |> Enum.map_join(&Base.decode16!/1)
      end
      |> Code.eval_quoted()

    val
  end
end
import BaseSigils
IO.inspect("ABCD234234234aaaaaa")
~OX<0x4142  0x43> <> a = "ABC123"
a
for _ <- 0..512, into: <<>> do
  <>
end