top | item 44664340

(no title)

cybrox | 7 months ago

Structure and control flow feels very Python/Ruby-ish, however, when you get into the depths of pattern matching and binary deconstruction or even macros, Elixir syntax can become somewhat messy. However, the same concepts, once understood, are extremely powerful for parsing or protocol handling.

Talking about stuff like this:

      nodes =
        node_data
        |> Input.split_by_line(trim: true)
        |> Enum.map(fn <<
                         t::binary-size(3),
                         " = (",
                         l::binary-size(3),
                         ", ",
                         r::binary-size(3),
                         ")"
                       >> ->
          {t, {l, r}}
        end)
        |> Enum.into(%{})

discuss

order

No comments yet.