# Pipechain: an alternative library to threading (with a few extras)

**URL:** <https://racket.discourse.group/t/pipechain-an-alternative-library-to-threading-with-a-few-extras/243>\
**Category:** Show & Tell\
**Created:** [November 24, 2021, 12:40am UTC](https://racket.discourse.group/t/pipechain-an-alternative-library-to-threading-with-a-few-extras/243 "2021-11-24T00:40:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![slaymaker1907](https://avatars.discourse-cdn.com/v4/letter/s/59ef9b/32.png) [@slaymaker1907](https://racket.discourse.group/u/slaymaker1907)\
**Post date:** [November 24, 2021, 12:40am UTC](https://racket.discourse.group/t/pipechain-an-alternative-library-to-threading-with-a-few-extras/243/1 "2021-11-24T00:40:26Z")

</div>

- [slaymaker1907/pipechain (github.com)](https://github.com/slaymaker1907/pipechain)
- [pipechain (racket-lang.org)](https://pkgs.racket-lang.org/package/pipechain)

I loved the idea behind the threading package but I didn't like how it implicitly added the threaded argument to the end (or beginning). It will still treat a non-parenthesized expression as a function, but otherwise you need to use the \_ variable.

Another thing I included in this package is an alternative to require that I think has a little more fluent syntax for renaming imports and pulling in everything with a prefix.

---

<div class="post-metadata">

**Author:** ![dstorrs](https://avatars.discourse-cdn.com/v4/letter/d/898d66/32.png) [@dstorrs](https://racket.discourse.group/u/dstorrs)\
**Post date:** [November 24, 2021, 4:25pm UTC](https://racket.discourse.group/t/pipechain-an-alternative-library-to-threading-with-a-few-extras/243/2 "2021-11-24T16:25:31Z")

</div>

Hi Dyllon,

It's been a while since I used `threading`; can you nail down for me how your version differs? Is it simply that the \_ is mandatory?

Also, speaking as a guy with a 'utils' collection that grew _way_ out of control (cf the `handy` collection) and now regrets it, may I suggest breaking the require-safe and define-proc macros out into separate libraries? pipeline/utils can require and then re-export all of those things so nothing will change from the perspective of your code or those who use it, but it would allow people to pull in some of the cool stuff you've written while keeping their application's code size as small as possible if they're going to use define-proc but not the threading part.

---

<div class="post-metadata">

**Author:** ![slaymaker1907](https://avatars.discourse-cdn.com/v4/letter/s/59ef9b/32.png) [@slaymaker1907](https://racket.discourse.group/u/slaymaker1907)\
**Post date:** [November 24, 2021, 6:27pm UTC](https://racket.discourse.group/t/pipechain-an-alternative-library-to-threading-with-a-few-extras/243/3 "2021-11-24T18:27:13Z")

</div>

I'll think about it, though I'm more a fan of large util libraries.

Another difference from threading is that it uses a syntax parameter for \_. This allows for renaming \_ if you desire, but more importantly, it allows for arbitrary nesting of ~\>. I've run into scenarios where trying to nest ~\> results in weirdness with \_.

Also forgot to mention that "(define var)" can be used within ~\> to keep track of a value within the ~\> pipeline for later reuse (the binding does not escape ~\> though).

---

<div class="post-metadata">

**Author:** ![dstorrs](https://avatars.discourse-cdn.com/v4/letter/d/898d66/32.png) [@dstorrs](https://racket.discourse.group/u/dstorrs)\
**Post date:** [November 24, 2021, 6:30pm UTC](https://racket.discourse.group/t/pipechain-an-alternative-library-to-threading-with-a-few-extras/243/4 "2021-11-24T18:30:49Z")

</div>

> [@slaymaker1907](#):
>
> Also forgot to mention that "(define var)" can be used within ~\> to keep track of a value within the ~\> pipeline for later reuse (the binding does not escape ~\> though).

Oh, cool. That's a very nice distinguishing feature as compared to `threading`. You should definitely document that.

Speaking of, the library currently has default empty documentation: [pipechain](https://docs.racket-lang.org/pipechain/index.html) Everything necessary is in the README file, so it would probably be a good idea to remove the Scribble.
