Closed moodymudskipper closed 4 years ago
is this too weird ?
(...) %.% {
toupper()
paste0("!")
}
rather than :
fseq({
toupper()
paste0("!")
})
I'm happy to spare parenthesis to help make the syntax clearer when using functionals.
...
has a special meaning but it's also never use as a standard variable and would work in that case.
... %.% head()
would be nice too but won't work (quotable but the call fails before first call is accessed).
or :
. %FS.% {
toupper()
paste0("!")
}
wich makes %FS..%
straightforward. It would only accept a dot as a lhs, which makes it a lot like a unary op without brackets, such as repeat
.
I think I like this last one.
%fs%
s faster to type than %FS.%
but probably less confusing to users to have a pattern.
We might drop the S though, F
like function seems good enough.
having a special pipe means we can't make a function as easily out of ligging, printing, viewing pipes, but those should be less needed in functionals.
done!
This old thread has been automatically locked. If you think you have found something related to this, please open a new issue and link to this old issue if necessary.
magrittr s functional sequences are useful when using a non tidyverse functional, where we don't have the formula notation. They are also more efficient than the formula notation.
They suffer from a bad flaw, they start with a
.
and it's been confusing users a lot, it still gets me sometimes.A workaround is to start the chain with (.) or {.}.
I think for nakedpipe it d be much better to have the fs start with something special,
(.)
would have been a great candidate but it would be confusing as then nakedpipe would do the opposite of magrittr.Technically we need an unary operator, so maybe we need a function and we'd do
fseq(expr)
. And maybefseq..()
for the explicit variant?