Created
August 31, 2015 09:33
-
-
Save itang/5c18111826fe1dc25f9f to your computer and use it in GitHub Desktop.
tap when
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule A do | |
def tap_when(target, c, f) do | |
if c do | |
IO.puts "yes" | |
f.(target) | |
else | |
IO.puts "no" | |
target | |
end | |
end | |
end | |
"hello" |> A.tap_when true, &(&1 <> ", itang") |> IO.puts |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
output:
yes
hello, itang