A collection of arrow macros.
Ported from @rplevy's Clojure library, swiss-arrows. See its README for usage examples.
"Muted post horn" image created by Zafiroblue05 and distributed under the CC BY-SA 3.0 license.
Add pynchon
to your deps
in your rebar.config
:
{deps, [
{pynchon, "0.5.0"}
]}.
To use the arrow macros, you can either include arrows.lfe
:
(include-lib "pynchon/include/arrows.lfe")
(defun foo ()
(-<>< (+ 1 2)
(list <> 2 1)
(list 5 <> 7)
(list 9 4 <>)))
... or make fully-qualified calls to the exported macros:
(defun bar ()
(pynchon:-<>< (+ 1 2)
(list <> 2 1)
(list 5 <> 7)
(list 9 4 <>)))
For (sparse) documentation, check out the Lodox-generated API docs.
Be sure to peruse the usage examples in the original swiss-arrows
repo, too.
Although some Clojure idioms therein don't translate to LFE,
the general ideas apply.
Copied from the swiss-arrows README.
Walter Tetzner, Stephen Compall, and I designed and implemented something similar to the "diamond wand" a couple of years ago.
Thanks to Alex Baranosky, Roman Perepelitsa, Paul Dorman, @rebcabin, and Stephen Compall for code contributions and conceptual contributions.
Copyright (C) 2012 Robert P. Levy
Copyright (C) 2015-2016 Eric Bailey
Distributed under the Eclipse Public License, the same as Clojure.