Jose's Example Code From 2023 Keynote

To add to it, it’s how you define infix operators in Elixir, for example:

def foo <~> bar do
  # ...
end

There are a set number of infix operators, you can’t just make them up, though I can’t remember where they are listed right now (sorry).

A quick way to try out the and version is like this:

defmodule Foo do
  import Kernel, except: [and: 2]

  def left and right do
    Enum.random([left, right])
  end

  def test do
    "foo" and "bar"
  end
end

Foo.test()