I recently saw something that I didn't realize was possible: you can embed pipelines in larger expressions.

For example you can create a tuple where each element in the tuple is created by a pipeline.

def do_something(param1, param2) do
    param1 |> step1() |> step2,
	param2 |> stepA() |> stepB

Each element in the tuple is created by its own pipeline. I had no idea this was even possible, but it shouldn't have been a surprise to me. Pipeline expressions evaluate to a value, just like any other expression. Previously, I was using pipelines to come up with a value that was returned from a function, so there's no reason why I can't use pipelines to compute a value anywhere else, including inside data structures such as tuples, lists, maps, and so forth.

So this was a bit of a "duh!" moment for me, since I should have realized that this was possible, but it's something I had simply never thought of until I saw it. It makes me glad that I read other people's code. It gives me ideas and patterns that I wouldn't have thought of otherwise.

This was a short one today, but I was excited enough to write about it on its own. It's not as if it fits well with the other topics I'm planning to write about in the near future.