Skip to content

Instantly share code, notes, and snippets.

@rugyoga
Last active September 7, 2022 17:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rugyoga/5231723d6ceea1a9380ce755ae32f147 to your computer and use it in GitHub Desktop.
Save rugyoga/5231723d6ceea1a9380ce755ae32f147 to your computer and use it in GitHub Desktop.
iex example
iex> nil |> Tree.add(2) |> Tree.add(1) |> Tree.add(3) |> Audit.to_string() |> IO.puts
github url: https://github.com/rugyoga/tree_ex/tree/main/lib/tree.ex#L15
local path: lib/tree.ex:15
code: item > i -> %Tree{audit(tree) | right: add(r, item)}
diff: [{[:right], {:add, %Tree{item: 3, left: nil, right: nil}}}]
=====
github url: https://github.com/rugyoga/tree_ex/tree/main/lib/tree.ex#L14
local path: lib/tree.ex:14
code: item < i -> %Tree{audit(tree) | left: add(l, item)}
diff: [{[:left], {:add, %Tree{item: 1, left: nil, right: nil}}}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment