+ Haskell :: https://www.schoolofhaskell.com/user/Gabriel439/Pipes%20tuto...
+ Racket :: https://docs.racket-lang.org/threading/index.html
+ Clojure :: https://clojure.org/guides/threading_macros
+ Julia :: https://syl1.gitbook.io/julia-language-a-concise-tutorial/us...
Julia's threading/piping is surprisingly limited, but the phrasing here (combined with the link) could make things confusing to a Julia beginner. So to make things clear:
* The linked page is talking about an external Julia package which provides a macro. And that macro lets you use the `_` syntax similar to what you describe Racket as having.
* Julia's default inbuilt piping syntax is the one with the single-argument limitation, and that's an operator, not a macro.
There's been a lot of discussion about bringing the `_` syntax or something like it to the base language, but there seem to be implementation difficulties. [1]
> +R :: https://r4ds.had.co.nz/pipes.html
This page is talking about magrittr piping (which is probably still the most popular), but base R also got inbuilt piping syntax with version 4.1. It automatically passes the piped-in value as the first argument to the subsequent function. [2] [3]
[1] https://github.com/JuliaLang/julia/pull/24990
+ Hack :: https://docs.hhvm.com/hack/expressions-and-operators/pipe — works with any functions, uses $$ for the pipelined value.
OCaml also has a similar thing (@@) but I can't find a good reference page.
Clojure also has a placeholder variant, the as-> form. Quoting the example the Clojure doc page (https://clojure.org/guides/threading_macros):
(as-> [:foo :bar] v
(map name v)
(first v)
(.substring v 1))
;; => "oo"I once did an Elixir course and really liked the pipelines. I continued implementing pipelines with a Scheme macro, but not concurrently.
Still, it's really cool to see how far we can push/mold the language to accomplish different tasks and patterns.
https://github.com/lendinghome/pipe_operator#-pipe_operator
"https://api.github.com/repos/ruby/ruby".pipe do
URI.parse
Net::HTTP.get
JSON.parse.fetch("stargazers_count")
yield_self { |n| "Ruby has #{n} stars" }
Kernel.puts
end
#=> Ruby has 15120 stars sig { params(obj: T.untyped).void }
def write(obj)
obj
.then { Array(_1) }
.then { @wrapper.pack(_1) }
.then { @deflate.deflate(_1, Zlib::SYNC_FLUSH) }
.then { @body.write(_1) }
endUFCS - https://en.m.wikipedia.org/wiki/Uniform_Function_Call_Syntax