No junk, straight to code

Assume data = {:ok, [1,2,3,4,5]} and we need to pass the data to the next function.

Do we need to write another function to do that job for this small operation? I don’t think so.

Check this…

TYPE –1 🎉

data
|> (fn {:ok, list} -> list  end).()
|> length()
5

TYPE — 2 🎉

Here, instead of sending the length itself, I would like to send a message something looks like Total Images : 5 Do I again need to use inline function fn again here? I don’t think so.

Check this…

data
|> (& {:ok, list} -> list ).()
|> length()
|> (&"Total Images : #{&1}").()

Hope you like them. Thanks for reading…


Join Our Telegram Channel

Blackoders
  Telegram
  Channel

Check out the GitHub repository on Killer Elixir Tips

Blackoders
  Telegram
  Channel Glad if you can contribute with a

🎉 Happy Coding :)


author image
WRITTEN BY
Blackode