-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ligature request: %>% pipe operator in R #473
Comments
There was a couple of request for getting better coverage for R. I’m not against it, but can’t think of a way to improve the rendering of those |
I'll give a design a shot in a day or so. |
@jtth Want to share your design idea? Would be awesome to have this in R. |
I would second this, and third this for colleagues who have commented on how ugly the pipe symbol is. Has anyone made progress on this? |
I don’t think R authors had anything in mind when they chose |
You could rotate the two |
I would propose to just use F# pipe ligature for |
There are several other popular R operators mentioned in #39. Not sure what can be done with them though. |
I would second the proposal to use the F# ligature for the R pipe %>% . With respect to the #39 issue, it would be nice to have some of the other symbols changed, but I think most R developers would tell you they use the %>% in maybe 1/4 of their lines of code, it is everywhere. I think it should have the highest priority. There was an earlier comment that RStudio does not support three-character ligatures. I am not sure about RStudio 1.0, but in RStudio 1.1 the double headed arrow <<- correctly changes to the ligature for that symbol with Fira Code. |
The |
There was an earlier comment that RStudio does not support three-character ligatures. I am not sure about RStudio 1.0, but in RStudio 1.1 the double headed arrow <<- correctly changes to the ligature for that symbol with Fira Code.
True!
I think most R developers would tell you they use the %>% in maybe 1/4 of their lines of code, it is everywhere
True!!!!
|
j-f1, could you elaborate on rule about all of the characters staying? |
Would like this as well. How about removing the slashes and extra dots in the percent symbols, something like:
|
I want the ligatures to resemble original characters combination |
See above ⬆️ 🙂 |
I agree with the suggestion of something like the F# pipe ligature (right-pointing triangle). The percent signs (which are really just there because of R's requirements for custom binary operators) could be reduced to individual small circles. Something like this: |
Yeah, that’s beautiful! And I agree about the percentages 👍
|
@timgoodman that's a lot better than what I had in mind. As long as the midline of the ∘ aligns with the centerline of the ▷ that's great! (Fun design note: this induces a size illusion such that the left circle appears smaller than the right. Dunno whether it'd be better to increase the size of the leftmost circle, or just leave it.) |
|
@holstius You want a paragraph marker and a hand? What? |
Either seemed appropriate to me.
%>% is read “and then”; it does the same thing pseudo-linguistically as a
paragraph break (that is, it separates “sentences”).
The “hand” is more of a visual analogy. There’s a rightward momentum.
On first read, I missed the point about preserving the elements of the
original characters. In that case, both my suggestions are way off the
mark.
…On Mon, Dec 11, 2017 at 9:14 AM Jordan T. Thevenow-Harrison < ***@***.***> wrote:
@holstius <https://github.com/holstius> You want a paragraph marker and a
hand? What?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#473 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAyaakESgjaXanj4yI5LiNmllWKtSyb8ks5s_WLjgaJpZM4OzrQB>
.
|
One idea for all of these would be to drop the second o on the first % and the first o on the second %, then elongate the center operator character. |
@tonsky Any good arguments against Else I think most of us would say: please implement 😉 |
@tonsky and others: I thought that a compromise between no resemblance to the original characters (as in the Even the compound pipe could be represented with uneven |
@epspi I like yours better than mine. Very nice! That's more clear and visually unpacks a lot better. |
@jzadra I’m afraid not. You’re on your own |
Ever since tidyverse, the |
Then maybe it’s time for an R specific fork... |
The relevance of this discussion will perish, since we now know base R will come up with a pipe in their next version as a drop-in replacement for the The pipe will probably be |
The pipe is only one of many inline operators in R. Anything between two % would be better with a ligature. (Last I read, the base R pipe was not planned to have the same behavior as the magrittr pipe unfortunately) Edit: see here for the major incompatibility https://twitter.com/bmwiernik/status/1334853345966780421?s=21 |
Whatever you like. This is the actual implementation and it looks like perfect drop-in to me: wch/r-source@a1425ad (off-topic mode off) |
@bwiernik It looks like instead of writing |
The new pipe doesn't replace magrittr's pipe - pls don't forget about this |
Hi - I made something like @kelleyvanevert 's suggestion for "whacky" percents in my own fork -
My implementation: The actual glyphs, spacing & size certainly need work - These things look great blown up but get teensy when viewed at 12pts it turns out, and the spacing on the pipes needs to be increased. Personally, @kelleyvanevert 's suggestion for "whacky" percents (i personally think of them as "bookend" percents) has been my favourite so far. Discussion of approach of bookending in generalI like the idea of "bookending" the enclosed operator in general, but whatever is done at least needs to suggest the underlying character. In the vein of @andrewcstewart 's comment:
List of proposed sketches by andrewcstewart
Proposed bookend that's evocative of % signI propose: To describe it:
The above shows two alternatives, either a fully vertical stem on the Personally, I think a diagonal stem tracks better as its more suggestive of the underlying character. To extend this: Alternatively, mirroring the rigthmost |
Here it is if you want to try it out: https://drive.google.com/drive/folders/1NAqWx8QT2KS-MrwRyFCUuaFvGpq4mP-b?usp=sharing A few iterations of this concept: With pipes aligned
|
R finally got a native pipe: https://www.r-bloggers.com/2021/05/the-new-r-pipe/ Due to the character sequence |
I'm really looking forward to these ligatures. Even if they would make my R coding look like an alien sci-fi movie, they're better than nothing and surely any other R programmer will agree with me that even the worst-looking of all of these (whichever that is) is better than not having the ligature at all... any lack of aesthetics is more on R side (having to implement custom operators with 3 characters, etc.). Sorry for necrobumping the issue, @tonsky, but since your last comment seems to be years old... Can you update/ expand your considerations on this? Thanks! |
Not a fan of this one... once you see the dick, you cannot unsee it... |
This comment was marked as off-topic.
This comment was marked as off-topic.
I like a connected glyph so that it looks like a single character vs 3 characters. But I'll be happy with anything, thanks for your work on this! |
I know this does not represent three characters in one glyph, but having the native pipe in mind, with the idea that magrittr’s pipe should be visually similar to the native one; yet, distinct; maybe this: feel free to hate it, I am not sure what my feelings are about it anyway... but I got @jzadra point, that I would be nice to have something more ligature-like. Three disjunct characters making a glyph feels wrong somehow, yet better than nothing... |
Agreed. Like I said, I'll be thrilled to have anything, and I love Firacode so I support whatever @tonsky feels is best! |
Absolutely agree. Ignore my shit. @tonsky thanks for adding this to a milestone! |
I wonder if it would be possible to write some kind of theme, in the interim, just to hide the I wonder how hard this could be for vs-code or r-studio? dataframe %>% filter(value %in% array) could be rendered as dataframe > filter(value in array) |
Probably not that hard, but does hiding characters with syntactical significance actually improve your code readability? Personally I don't think hiding the glyph altogether is a particularly good idea, however, my experience is that it wasn't that hard to implement a new ligature, I think I just used the trial version of the Glyphs (Mac only) app to make my variation of this ligature. Just to reiterate, I've implemented a version of this ligature that you can download and install: I'm not saying it's the canonical version, or even good, but I think it's better than nothing, and certainly better than hiding characters that change your code's meaning. |
Commenting here to subscribe to updates, and also to suggest this as a possibility: The exact proportions should obviously be fine tuned more but I think this might be a good starting point. The ligature is both identifiable as %>% but also cohesive as a single unit. Other iterations that could be considered if people think the ligature isn't clear enough:
This is my draft idea, so feedback is welcome, thanks. |
We use the pipe operator
%>%
a lot in the Tidyverse set of packages in the R programming language. It's a way of stringing together many functions, converting them from prefix to infix. It would be really nice to have a pipe ligature.The text was updated successfully, but these errors were encountered: