Thanks! But I think you missed one _
character after the f
, which makes a big difference:
ClearAll[\[Bullet]];
\[Bullet] /: f_[pre___, \[Bullet], post___] := With[
{
n = Length[List@pre],
m = Length[List@post]
},
Curry[f, Join[Range[n], {n + m + 1}, Range[m] + n]][pre, post]
];
I have to say, this is perhaps the coolest thing I've stumbled across in a long time. As another Windows user, I couldn't find an easy key combo to enter the bullet point, so instead I found that hitting Escape bu Escape to print out \[Bullet] in a notebook works pretty well (and should be OS-independent). It's perhaps not as fast as Option + 8, but it should be good enough.
As somebody who really likes to use RightComposition
, this would be a fantastic feature to build into the language, as it's quite a pain to have to use parentheses (and the &
) when chaining many "pure functions" together. Until then (assuming it would be implemented) I think I'll be including this definition into more of my projects.