4 ms·
Sorry for my ignorance, but what kind of lisp has piping? Or what is the vertical line operator called? (torus :z 60 30 | twist :y 0.07 | rotate-pi
by anhner 4y ago
Sorry for my ignorance, but what kind of lisp has piping? Or what is the vertical line operator called?
(torus :z 60 30
| twist :y 0.07
| rotate-pi :y t :z 0.05
...
- ianthehenry 4y agoThis is described later in the tutorial (ctrl-f "lisp heresy"). It's a macro that I wrote, not something built into Janet -- I'm sure I'm not the first person to do this, but I'm not aware of any lisps that have such a construct built-in.
- spapas82 4y agoClojure has the thread first/last macros -> and ->> which pipes each result to the next form.
- ianthehenry 4y agoYeah, and Janet copies Clojure's threading macros (that's how I implemented pipe syntax -- split on pipes, add some parens, and stick them into a -> form). I've just never seen it done infix like this -- it's very convenient when you don't have something like paredit to quickly wrap an expression.
- eyelidlessness 4y agoAnd this is why Lisp is amazing. Seeing the question I immediately thought “this looks like a really nice convenience macro for the author’s preferred formatting”!