Skip to content

Instantly share code, notes, and snippets.

@mattludwigs
Created May 26, 2017 14:54
Show Gist options
  • Save mattludwigs/5bc8f1d26876b613b9ef22a524c6135a to your computer and use it in GitHub Desktop.
Save mattludwigs/5bc8f1d26876b613b9ef22a524c6135a to your computer and use it in GitHub Desktop.
defmodule MapComposeTest do
use ExUnit.Case
test "Enum.map function composition" do
not_inner_composed =
"hello world"
|> String.split(" ")
|> Enum.map(&String.reverse/1)
|> Enum.map(&String.upcase/1)
inner_composed =
"hello world"
|> String.split(" ")
|> Enum.map(& String.reverse(&1) |> String.upcase())
assert not_inner_composed == inner_composed
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment