# \#pipe-operator

**URL:** https://forum.elixirforum.com/tag/pipe-operator/1072.md

[Latest](https://forum.elixirforum.com/latest.md) · [Categories](https://forum.elixirforum.com/categories.md) · [Tags](https://forum.elixirforum.com/tags.md)

---

## [Could Graph-Based Pipelines Become an Elixir Killer Feature?](https://forum.elixirforum.com/t/could-graph-based-pipelines-become-an-elixir-killer-feature/76997)

<div class="topic-metadata">

**Author:** [@brecabral](https://forum.elixirforum.com/u/brecabral)\
**Replies:** 11\
**Last updated:** [October 13, 2026, 5:12pm UTC](https://forum.elixirforum.com/t/could-graph-based-pipelines-become-an-elixir-killer-feature/76997 "2026-10-13T17:12:54Z")

</div>

From Pipes to Graphs: Could Elixir Make Control Flow More Composable? Recently, while studying LangGraph, and particularly the evolution from LangChain’s linear chains toward graph-based workflows, I started wondering: w…

---

## [Arrows - extended pipe operators (e.g. pipe to any argument position)](https://forum.elixirforum.com/t/arrows-extended-pipe-operators-e-g-pipe-to-any-argument-position/65602)

<div class="topic-metadata">

**Author:** [@mayel](https://forum.elixirforum.com/u/mayel)\
**Replies:** 9\
**Last updated:** [April 20, 2025, 8:37pm UTC](https://forum.elixirforum.com/t/arrows-extended-pipe-operators-e-g-pipe-to-any-argument-position/65602 "2025-04-20T20:37:42Z")

</div>

Provides OK-piping (similar to libraries like ok) and adds the ability to pipe into any argument position (similar to magritte) of the following function (or nested function). By inserting ... where you would like the va…

---

## [How do you all enter the pipe operator |\>?](https://forum.elixirforum.com/t/how-do-you-all-enter-the-pipe-operator/70242)

<div class="topic-metadata">

**Author:** [@BartOtten](https://forum.elixirforum.com/u/BartOtten)\
**Replies:** 27\
**Last updated:** [April 7, 2025, 8:48pm UTC](https://forum.elixirforum.com/t/how-do-you-all-enter-the-pipe-operator/70242 "2025-04-07T20:48:42Z")

</div>

How do you all enter the pipe operator |\> on your keyboard? I keep having troubles with it :frowning:

---

## [Is there a keyboard shortcut for the Elixir pipe operator in Livebook?](https://forum.elixirforum.com/t/is-there-a-keyboard-shortcut-for-the-elixir-pipe-operator-in-livebook/69453)

<div class="topic-metadata">

**Author:** [@octavio-robles](https://forum.elixirforum.com/u/octavio-robles)\
**Replies:** 2\
**Last updated:** [February 18, 2025, 7:58pm UTC](https://forum.elixirforum.com/t/is-there-a-keyboard-shortcut-for-the-elixir-pipe-operator-in-livebook/69453 "2025-02-18T19:58:13Z")

</div>

Hi everyone, I’ve been working predominantly with R for most of my projects, and I’ve grown quite accustomed to using Shift+Command+M to insert the pipe operator (%\>%) in RStudio. Naturally, when I started exploring Eli…

---

## [Strange Output When Filtering List with \`Enum.filter/2\`](https://forum.elixirforum.com/t/strange-output-when-filtering-list-with-enum-filter-2/64190)

<div class="topic-metadata">

**Author:** [@holasoymas](https://forum.elixirforum.com/u/holasoymas)\
**Replies:** 2\
**Last updated:** [June 13, 2024, 12:24pm UTC](https://forum.elixirforum.com/t/strange-output-when-filtering-list-with-enum-filter-2/64190 "2024-06-13T12:24:01Z")

</div>

I’m encountering a strange issue when using Enum.filter/2 in my Elixir script. The problem occurs when I filter a list with a condition that elements should be greater than a certain value using pipe operator. pipe\_ope…

---

## [Piping results of single-line function](https://forum.elixirforum.com/t/piping-results-of-single-line-function/61039)

<div class="topic-metadata">

**Author:** [@kwhite](https://forum.elixirforum.com/u/kwhite)\
**Replies:** 2\
**Last updated:** [January 17, 2024, 4:33am UTC](https://forum.elixirforum.com/t/piping-results-of-single-line-function/61039 "2024-01-17T04:33:20Z")

</div>

I just ran into this unexpected behavior. I had a short function that is piping its result into other functions. When I converted the short function to a one-liner, the result changed. I expected the EOL to terminate th…

---

## [Conditional piping part of the language?](https://forum.elixirforum.com/t/conditional-piping-part-of-the-language/55524)

<div class="topic-metadata">

**Author:** [@Gilou06](https://forum.elixirforum.com/u/Gilou06)\
**Replies:** 45\
**Last updated:** [May 3, 2023, 4:40pm UTC](https://forum.elixirforum.com/t/conditional-piping-part-of-the-language/55524 "2023-05-03T16:40:05Z")

</div>

Hello, I keep using a paradigme using a homemade function to make my life easier when piping. I wonder if there is a better way to achieve the same result, maybe something already part of Elixir language. Instead of w…

---

## [Adding a conditional to the pipeline](https://forum.elixirforum.com/t/adding-a-conditional-to-the-pipeline/53025)

<div class="topic-metadata">

**Author:** [@dub2](https://forum.elixirforum.com/u/dub2)\
**Replies:** 1\
**Last updated:** [January 7, 2023, 4:12am UTC](https://forum.elixirforum.com/t/adding-a-conditional-to-the-pipeline/53025 "2023-01-07T04:12:36Z")

</div>

def eta() do result = @dday |\> Timex.diff(NaiveDateTime.utc\_now(), :duration) |\> Timex.format\_duration(:humanized) if String.contains?(result, "sec") do result else String.repla…

---

## [Why I can't use anon functions in pipes](https://forum.elixirforum.com/t/why-i-cant-use-anon-functions-in-pipes/50966)

<div class="topic-metadata">

**Author:** [@nikiiv](https://forum.elixirforum.com/u/nikiiv)\
**Replies:** 5\
**Last updated:** [October 12, 2022, 6:34pm UTC](https://forum.elixirforum.com/t/why-i-cant-use-anon-functions-in-pipes/50966 "2022-10-12T18:34:25Z")

</div>

I am learning Elixir and I wonder why I can’t use anon function in a pipe but must use the then macro For example this works “Hello” |\> String.reverse |\> String.upcase |\> then(&(“Weird text #{&1}”)) But of course this…

---

## [Dot (.) operator with pipe operator](https://forum.elixirforum.com/t/dot-operator-with-pipe-operator/49492)

<div class="topic-metadata">

**Author:** [@hawkyre](https://forum.elixirforum.com/u/hawkyre)\
**Replies:** 5\
**Last updated:** [August 11, 2022, 7:12pm UTC](https://forum.elixirforum.com/t/dot-operator-with-pipe-operator/49492 "2022-08-11T19:12:06Z")

</div>

Is there any way to leverage the pipe operator to access properties of an object after a sequence of operations? I’m trying to do a sequence of operations followed by accessing a property in the final map but I can’t ge…

---

## [Why did not optimize \`Enum.map\`s chain](https://forum.elixirforum.com/t/why-did-not-optimize-enum-map-s-chain/47931)

<div class="topic-metadata">

**Author:** [@keep\_zen](https://forum.elixirforum.com/u/keep_zen)\
**Replies:** 11\
**Last updated:** [May 25, 2022, 2:20pm UTC](https://forum.elixirforum.com/t/why-did-not-optimize-enum-map-s-chain/47931 "2022-05-25T14:20:08Z")

</div>

For a functor, map(map(functor, fun), fun2) equal as map(functor, fun2\*fun). In Elixir, I think Enum module is a functor, but |\> did not optimize it. Like this: defmodule A do def add1(e) do IO.puts("+1") …

---

## [Strange warnings when \`use\`ing ok\_jose library](https://forum.elixirforum.com/t/strange-warnings-when-use-ing-ok-jose-library/45907)

<div class="topic-metadata">

**Author:** [@benonymus](https://forum.elixirforum.com/u/benonymus)\
**Replies:** 2\
**Last updated:** [February 9, 2022, 7:29am UTC](https://forum.elixirforum.com/t/strange-warnings-when-use-ing-ok-jose-library/45907 "2022-02-09T07:29:13Z")

</div>

Hey, I started to play around with the ok\_jose library in a project, and when I compile the code I get these warnings: warning: this clause cannot match because a previous clause at line 73 always matches Warning: li…

---

## [Another pipe enhancement topc: |\>\> (Ruby Object#tap like pipe)](https://forum.elixirforum.com/t/another-pipe-enhancement-topc-ruby-object-tap-like-pipe/43478)

<div class="topic-metadata">

**Author:** [@dsounded](https://forum.elixirforum.com/u/dsounded)\
**Replies:** 2\
**Last updated:** [October 30, 2021, 8:39am UTC](https://forum.elixirforum.com/t/another-pipe-enhancement-topc-ruby-object-tap-like-pipe/43478 "2021-10-30T08:39:55Z")

</div>

Hello dear community! So it came from my daily tasks, it’s just a proposal which once approved I’d gladly try to implement. Before creating the topic I tried to search if something like that was already asked, so seems…

---

## [Why should we iterate a list twice to pipe 2 aggregate functions?](https://forum.elixirforum.com/t/why-should-we-iterate-a-list-twice-to-pipe-2-aggregate-functions/35762)

<div class="topic-metadata">

**Author:** [@ahmadferdous](https://forum.elixirforum.com/u/ahmadferdous)\
**Replies:** 13\
**Last updated:** [November 25, 2020, 3:16pm UTC](https://forum.elixirforum.com/t/why-should-we-iterate-a-list-twice-to-pipe-2-aggregate-functions/35762 "2020-11-25T15:16:24Z")

</div>

I have structs Company, Employee and a list of struct values employees. Struct Employee contains 2 fields - hours and bill. I need to know total hours and total bill. Should I iterate once (for loop?!) to calculate both…

---

## [Nicer way to pipe?](https://forum.elixirforum.com/t/nicer-way-to-pipe/35515)

<div class="topic-metadata">

**Author:** [@rm-rf-etc](https://forum.elixirforum.com/u/rm-rf-etc)\
**Replies:** 6\
**Last updated:** [November 13, 2020, 3:53am UTC](https://forum.elixirforum.com/t/nicer-way-to-pipe/35515 "2020-11-13T03:53:58Z")

</div>

This is basically the same question I’ve asked before, I’m just wondering if anything has changed since I last asked, or if there’s any other ways to do this thing that I am doing. I know there’s been proposals for alte…

---

## [How to improve this snippet (piping result of a function into another function) with Mogrify](https://forum.elixirforum.com/t/how-to-improve-this-snippet-piping-result-of-a-function-into-another-function-with-mogrify/35157)

<div class="topic-metadata">

**Author:** [@chemist](https://forum.elixirforum.com/u/chemist)\
**Replies:** 6\
**Last updated:** [October 27, 2020, 3:23pm UTC](https://forum.elixirforum.com/t/how-to-improve-this-snippet-piping-result-of-a-function-into-another-function-with-mogrify/35157 "2020-10-27T15:23:16Z")

</div>

Hi, hope for any wisdom on how to improve this code snippet or if there are bits of knowledge I appear to be lacking Basically I want to create a map called data containing a range of persons with names ranging from Per…

---

## [Magritte - yet another "better pipe operator" library](https://forum.elixirforum.com/t/magritte-yet-another-better-pipe-operator-library/33673)

<div class="topic-metadata">

**Author:** [@hauleth](https://forum.elixirforum.com/u/hauleth)\
**Replies:** 24\
**Last updated:** [August 18, 2020, 1:36pm UTC](https://forum.elixirforum.com/t/magritte-yet-another-better-pipe-operator-library/33673 "2020-08-18T13:36:12Z")

</div>

Simple and clean library that is inspired by discussion in Elixir’s issue tracker and uses operator suggested by @josevalim (however it may change, other operator that I was considering was &\_) Short example of how th…

---

## [A simple macro to allow bare captures in pipes](https://forum.elixirforum.com/t/a-simple-macro-to-allow-bare-captures-in-pipes/32516)

<div class="topic-metadata">

**Author:** [@Qqwy](https://forum.elixirforum.com/u/Qqwy)\
**Replies:** 31\
**Last updated:** [July 27, 2020, 5:21pm UTC](https://forum.elixirforum.com/t/a-simple-macro-to-allow-bare-captures-in-pipes/32516 "2020-07-27T17:21:47Z")

</div>

EDIT: CapturePipe has been released as a library! Please give it a go and let us know if you find any mistakes. Hi everyone! Yesterday evening (it was already late… :sleeping:) I was reflecting a bit about common pat…

---

## [Convert multiple map values conditionally](https://forum.elixirforum.com/t/convert-multiple-map-values-conditionally/31606)

<div class="topic-metadata">

**Author:** [@silviurosu](https://forum.elixirforum.com/u/silviurosu)\
**Replies:** 4\
**Last updated:** [May 18, 2020, 11:08am UTC](https://forum.elixirforum.com/t/convert-multiple-map-values-conditionally/31606 "2020-05-18T11:08:45Z")

</div>

I need to convert in place in a map some values only of they exist. The key can be either binary or atom. Is there a more Elixir way to do it than my solution below? defp convert\_time\_params(params) do params …

---

## [Match on the end of a pipe (Matchpipe?)](https://forum.elixirforum.com/t/match-on-the-end-of-a-pipe-matchpipe/20650)

<div class="topic-metadata">

**Author:** [@sebsel](https://forum.elixirforum.com/u/sebsel)\
**Replies:** 19\
**Last updated:** [January 23, 2020, 11:46pm UTC](https://forum.elixirforum.com/t/match-on-the-end-of-a-pipe-matchpipe/20650 "2020-01-23T23:46:42Z")

</div>

So I have looked for this topic and found similar ones but not actually this one. Forgive me if I missed it. While I really love Elixirs pipelines, I see myself writing this pattern from time to time: def some\_function…

---

## [Conditional in Ecto.query](https://forum.elixirforum.com/t/conditional-in-ecto-query/17541)

<div class="topic-metadata">

**Author:** [@jihantoro](https://forum.elixirforum.com/u/jihantoro)\
**Replies:** 9\
**Last updated:** [November 5, 2019, 5:43pm UTC](https://forum.elixirforum.com/t/conditional-in-ecto-query/17541 "2019-11-05T17:43:51Z")

</div>

my original syntax : result = Enum.map( from(Repo, where: ^whitelisted\_params) |\> where(\[schema\], like(schema.nama, ^"#{nama}%")) |\> limit(^query\_limit) |\> Repo.all(), fn elem -\> elem |\> Map.…

---

## [Conditional pipe operator on error tuple](https://forum.elixirforum.com/t/conditional-pipe-operator-on-error-tuple/24682)

<div class="topic-metadata">

**Author:** [@danj](https://forum.elixirforum.com/u/danj)\
**Replies:** 4\
**Last updated:** [August 15, 2019, 4:11pm UTC](https://forum.elixirforum.com/t/conditional-pipe-operator-on-error-tuple/24682 "2019-08-15T16:11:35Z")

</div>

I wanted to share this code for a problem that regularly comes up and that I usually solve with multi-headed functions or with clauses. The issue: handling an error tuple in a pipeline situation by skipping steps. Here’…

---

## [Yet another pipe to nth argument discussion](https://forum.elixirforum.com/t/yet-another-pipe-to-nth-argument-discussion/24649)

<div class="topic-metadata">

**Author:** [@Ankhers](https://forum.elixirforum.com/u/Ankhers)\
**Replies:** 11\
**Last updated:** [August 14, 2019, 8:47pm UTC](https://forum.elixirforum.com/t/yet-another-pipe-to-nth-argument-discussion/24649 "2019-08-14T20:47:22Z")

</div>

Just a little information upfront. Generally speaking, if I feel like I need to either break a pipe chain or use an anonymous function in order to pipe into an arbitrary argument, I will create a named function instead. …

---

## [Beautiful Pipelines](https://forum.elixirforum.com/t/beautiful-pipelines/18002)

<div class="topic-metadata">

**Author:** [@Qqwy](https://forum.elixirforum.com/u/Qqwy)\
**Replies:** 1\
**Last updated:** [November 19, 2018, 7:53pm UTC](https://forum.elixirforum.com/t/beautiful-pipelines/18002 "2018-11-19T19:53:17Z")

</div>

Inspired by this topic I thought it might be interesting to talk about what pipelines we have encountered in the wild: Whenever you come across a piece of code featuring a pipeline that you think is cool or elegant, fe…

---

## [Funny pipe code](https://forum.elixirforum.com/t/funny-pipe-code/17964)

<div class="topic-metadata">

**Author:** [@zerogvt](https://forum.elixirforum.com/u/zerogvt)\
**Replies:** 11\
**Last updated:** [November 16, 2018, 2:26pm UTC](https://forum.elixirforum.com/t/funny-pipe-code/17964 "2018-11-16T14:26:48Z")

</div>

Hi all, first post here (also a newbie in elixir/FP). So, I have next pipe code which works but also looks funny: case {status\_code, body} do {200, \_} -\> edges = Poison.Parser.parse!(body) |\> Map.…

---

## [Which language first introduced the pipe operator?](https://forum.elixirforum.com/t/which-language-first-introduced-the-pipe-operator/16791)

<div class="topic-metadata">

**Author:** [@DevotionGeo](https://forum.elixirforum.com/u/DevotionGeo)\
**Replies:** 11\
**Last updated:** [October 5, 2018, 8:34pm UTC](https://forum.elixirforum.com/t/which-language-first-introduced-the-pipe-operator/16791 "2018-10-05T20:34:32Z")

</div>

Elm has pipe operator like Elixir does. I read on reddit that OCaml and F# also have pipe operators. I’m curious if it was Elixir which introduced the pipe operator and other languages copied it, or it was some other la…
