Settings

Theme

Show HN: Magrittr-like pipe syntax for IPython

github.com

2 points by smacke 2 months ago · 1 comment · 1 min read

Reader

Hi HN, sharing my holiday season passion project, pipescript, which lets you write code like this in Jupyter Python notebooks:

42 |> $+1 # 43

The $ is a placeholder for the value in the previous pipeline step, like (.) in magrittr.

There's a ton more you can do thanks to macro expansion capabilities added by pipescript. Here's 5 factorial:

range(1, 6) |> reduce[$$] # 120

Placeholders can also be given informative names unlike in magrittr:

range(1, 6) |> reduce[$accum$current] # 120

The lack of names placeholders in magrittr had been my biggest complaint. Anyway I had a lot of fun scratching this itch and am really proud of the result, hope you like it too. :)

smackeOP 2 months ago

Some auto formatting italicized the text between * on different lines :')

Should be `reduce[$*$]`

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection