-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
An interesting use of backpipe is when it is used to clear some clutter. Two uses come to mind.
- Defining S4 Methods : reduces clutter associated with bracketings
- Using logging : Put the logging command first so that it is easy to see.
This makes them more like the way that if works.
#' ## S4 Methods
setMethod( "cx", signature("character","character"), . ) %:%
function(x,y) { print("hw") }
#' ## Logging
warn %:% "This is not a love song"There are some variants of this. For example, you could backwardly create a list of arguments that are then passed to the first argument ... always a function.
warn %:% "you've been warned" %:% immediate=TRUE Even better if we can give it a special operator:
warn : "you've been warned" Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels