-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathbpipe.R
More file actions
641 lines (618 loc) · 22.2 KB
/
bpipe.R
File metadata and controls
641 lines (618 loc) · 22.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
#' S3 dispatch on class of pipe_left_arg.
#'
#' For formal documentation please see \url{https://github.com/WinVector/wrapr/blob/master/extras/wrapr_pipe.pdf}.
#'
#' @param pipe_left_arg left argument.
#' @param pipe_right_arg substitute(pipe_right_arg) argument.
#' @param pipe_environment environment to evaluate in.
#' @param left_arg_name name, if not NULL name of left argument.
#' @param pipe_string character, name of pipe operator.
#' @param right_arg_name name, if not NULL name of right argument.
#' @return result
#'
#' @seealso \code{\link{apply_left.default}}
#'
#' @examples
#'
#' apply_left.character <- function(pipe_left_arg,
#' pipe_right_arg,
#' pipe_environment,
#' left_arg_name,
#' pipe_string,
#' right_arg_name) {
#' if(is.language(pipe_right_arg)) {
#' wrapr::apply_left_default(pipe_left_arg,
#' pipe_right_arg,
#' pipe_environment,
#' left_arg_name,
#' pipe_string,
#' right_arg_name)
#' } else {
#' paste(pipe_left_arg, pipe_right_arg)
#' }
#' }
#' setMethod(
#' wrapr::apply_right_S4,
#' signature = c(pipe_left_arg = "character", pipe_right_arg = "character"),
#' function(pipe_left_arg,
#' pipe_right_arg,
#' pipe_environment,
#' left_arg_name,
#' pipe_string,
#' right_arg_name) {
#' paste(pipe_left_arg, pipe_right_arg)
#' })
#'
#' "a" %.>% 5 %.>% 7
#'
#' "a" %.>% toupper(.)
#'
#' q <- "z"
#' "a" %.>% q
#'
#'
#' @export
#'
apply_left <- function(pipe_left_arg,
pipe_right_arg,
pipe_environment,
left_arg_name,
pipe_string,
right_arg_name) {
force(pipe_environment)
UseMethod("apply_left", pipe_left_arg)
}
# things we don't want to piple into
forbidden_pipe_destination_names <- c("else",
"return",
"stop", "warning",
"in", "next", "break",
"TRUE", "FALSE", "NULL", "Inf", "NaN",
"NA", "NA_integer_", "NA_real_", "NA_complex_", "NA_character_",
"->", "->>", "<-", "<<-", "=", # precedence should ensure we do not see these
"?",
"...",
".",
";", ",",
"list", "c", ":",
"for")
#' S3 dispatch on class of pipe_left_arg.
#'
#' Place evaluation of left argument in \code{.} and then evaluate right argument.
#'
#' @param pipe_left_arg left argument
#' @param pipe_right_arg substitute(pipe_right_arg) argument
#' @param pipe_environment environment to evaluate in
#' @param left_arg_name name, if not NULL name of left argument.
#' @param pipe_string character, name of pipe operator.
#' @param right_arg_name name, if not NULL name of right argument.
#' @return result
#'
#' @seealso \code{\link{apply_left}}
#'
#' @examples
#'
#' 5 %.>% sin(.)
#'
#' @export
#'
apply_left_default <- function(pipe_left_arg,
pipe_right_arg,
pipe_environment,
left_arg_name,
pipe_string,
right_arg_name) {
force(pipe_environment)
# remove some exceptional cases
if(length(pipe_right_arg)<1) {
stop("wrapr::apply_left.default does not allow direct piping into NULL/empty")
}
# check for piping into constants such as 4 %.>% 5
if(!is.language(pipe_right_arg)) {
stop(paste("wrapr::apply_left.default does not allow piping into obvious concrete right-argument (clearly can't depend on left argument):\n",
ifelse(is.null(left_arg_name), "", left_arg_name), paste(class(pipe_left_arg), collapse = ", "), "\n",
ifelse(is.null(right_arg_name), "", right_arg_name), paste(class(pipe_right_arg), collapse = ", ")),
call. = FALSE)
}
if(is.call(pipe_right_arg) && (is.name(pipe_right_arg[[1]]))) {
call_text <- as.character(pipe_right_arg[[1]])
# mostly grabbing reserved words that are in the middle
# of something, or try to alter control flow (like return).
if(isTRUE(call_text %in% forbidden_pipe_destination_names)) {
stop(paste0("to reduce surprising execution behavior wrapr::apply_left.default does not allow direct piping into some expressions (such as \"",
wrapr_deparse(pipe_right_arg),
"\")."))
}
}
# eval by with pipe_left_arg's value in dot (simulates chaining)
assign(".", pipe_left_arg,
envir = pipe_environment,
inherits = FALSE)
eval(pipe_right_arg,
envir = pipe_environment,
enclos = pipe_environment)
}
#' S3 dispatch on class of pipe_left_arg.
#'
#' Place evaluation of left argument in \code{.} and then evaluate right argument.
#'
#' @param pipe_left_arg left argument
#' @param pipe_right_arg substitute(pipe_right_arg) argument
#' @param pipe_environment environment to evaluate in
#' @param left_arg_name name, if not NULL name of left argument.
#' @param pipe_string character, name of pipe operator.
#' @param right_arg_name name, if not NULL name of right argument.
#' @return result
#'
#' @seealso \code{\link{apply_left}}
#'
#' @examples
#'
#' 5 %.>% sin(.)
#'
#' @export
#'
apply_left.default <- function(pipe_left_arg,
pipe_right_arg,
pipe_environment,
left_arg_name,
pipe_string,
right_arg_name) {
force(pipe_environment)
apply_left_default(pipe_left_arg = pipe_left_arg,
pipe_right_arg = pipe_right_arg,
pipe_environment = pipe_environment,
left_arg_name = left_arg_name,
pipe_string = pipe_string,
right_arg_name = right_arg_name)
}
#' S3 dispatch on class of pipe_right_argument.
#'
#' Triggered if right hand side of pipe stage was a name that does not resolve to a function.
#' For formal documentation please see \url{https://github.com/WinVector/wrapr/blob/master/extras/wrapr_pipe.pdf}.
#'
#'
#' @param pipe_left_arg left argument
#' @param pipe_right_arg right argument
#' @param pipe_environment environment to evaluate in
#' @param left_arg_name name, if not NULL name of left argument.
#' @param pipe_string character, name of pipe operator.
#' @param right_arg_name name, if not NULL name of right argument.
#' @return result
#'
#' @seealso \code{\link{apply_left}}, \code{\link{apply_right_S4}}
#'
#' @examples
#'
#' # simulate a function pointer
#' apply_right.list <- function(pipe_left_arg,
#' pipe_right_arg,
#' pipe_environment,
#' left_arg_name,
#' pipe_string,
#' right_arg_name) {
#' pipe_right_arg$f(pipe_left_arg)
#' }
#'
#' f <- list(f=sin)
#' 2 %.>% f
#' f$f <- cos
#' 2 %.>% f
#'
#' @export
#'
apply_right <- function(pipe_left_arg,
pipe_right_arg,
pipe_environment,
left_arg_name,
pipe_string,
right_arg_name) {
force(pipe_environment)
UseMethod("apply_right", pipe_right_arg)
}
#' Default apply_right implementation.
#'
#' Default apply_right implementation: S4 dispatch to apply_right_S4.
#'
#' @param pipe_left_arg left argument
#' @param pipe_right_arg pipe_right_arg argument
#' @param pipe_environment environment to evaluate in
#' @param left_arg_name name, if not NULL name of left argument.
#' @param pipe_string character, name of pipe operator.
#' @param right_arg_name name, if not NULL name of right argument.
#' @return result
#'
#' @seealso \code{\link{apply_left}}, \code{\link{apply_right}}, \code{\link{apply_right_S4}}
#'
#' @examples
#'
#' # simulate a function pointer
#' apply_right.list <- function(pipe_left_arg,
#' pipe_right_arg,
#' pipe_environment,
#' left_arg_name,
#' pipe_string,
#' right_arg_name) {
#' pipe_right_arg$f(pipe_left_arg)
#' }
#'
#' f <- list(f=sin)
#' 2 %.>% f
#' f$f <- cos
#' 2 %.>% f
#'
#' @export
#'
apply_right.default <- function(pipe_left_arg,
pipe_right_arg,
pipe_environment,
left_arg_name,
pipe_string,
right_arg_name) {
force(pipe_environment)
apply_right_S4(pipe_left_arg = pipe_left_arg,
pipe_right_arg = pipe_right_arg,
pipe_environment = pipe_environment,
left_arg_name = left_arg_name,
pipe_string = pipe_string,
right_arg_name = right_arg_name)
}
#' S4 dispatch method for apply_right.
#'
#' Intended to be generic on first two arguments.
#'
#' @param pipe_left_arg left argument
#' @param pipe_right_arg pipe_right_arg argument
#' @param pipe_environment environment to evaluate in
#' @param left_arg_name name, if not NULL name of left argument.
#' @param pipe_string character, name of pipe operator.
#' @param right_arg_name name, if not NULL name of right argument.
#' @return result
#'
#' @seealso \code{\link{apply_left}}, \code{\link{apply_right}}
#'
#' @examples
#'
#' a <- data.frame(x = 1)
#' b <- data.frame(x = 2)
#'
#' # a %.>% b # will (intentionally) throw
#'
#' setMethod(
#' "apply_right_S4",
#' signature("data.frame", "data.frame"),
#' function(pipe_left_arg,
#' pipe_right_arg,
#' pipe_environment,
#' left_arg_name,
#' pipe_string,
#' right_arg_name) {
#' rbind(pipe_left_arg, pipe_right_arg)
#' })
#'
#'
#' a %.>% b # should equal data.frame(x = c(1, 2))
#'
#' @export
#'
apply_right_S4 <- function(pipe_left_arg,
pipe_right_arg,
pipe_environment,
left_arg_name,
pipe_string,
right_arg_name) {
force(pipe_environment)
# # go to default left S3 dispatch on apply_left()
# apply_left(pipe_left_arg = pipe_left_arg,
# pipe_right_arg = pipe_right_arg,
# pipe_environment = pipe_environment,
# left_arg_name = left_arg_name,
# pipe_string = pipe_string,
# right_arg_name = right_arg_name)
stop(paste("wrapr::apply_right_S4 default called with classes:\n",
ifelse(is.null(left_arg_name), "", left_arg_name), paste(class(pipe_left_arg), collapse = ", "), "\n",
ifelse(is.null(right_arg_name), "", right_arg_name), paste(class(pipe_right_arg), collapse = ", "), "\n",
" must have a more specific S4 method defined to dispatch\n"),
call. = FALSE)
}
#' @importFrom methods setGeneric
NULL
# lash in S4 dispatch
methods::setGeneric(
name = "apply_right_S4")
#' Pipe dispatch implementation.
#'
#' This is a helper for implementing additional pipes.
#'
#' @param pipe_left_arg possibily unevaluated left argument.
#' @param pipe_right_arg possibly unevaluated right argument.
#' @param pipe_environment environment to evaluate in.
#' @param pipe_string character, name of pipe operator.
#' @return result
#'
#' @examples
#'
#' # Example: how wrapr pipe is implemented
#'
#' print(`%.>%`)
#'
#'
#'
#'
#' # Example: create a value that causes pipelines to record steps.
#'
#' # inject raw values into wrapped/annotated world
#' unit_recording <- function(x, recording = paste(as.expression(substitute(x)), collapse = '\n')) {
#' res <- list(value = x, recording = recording)
#' class(res) <- "recording_value"
#' res
#' }
#'
#' # similar to bind or >>=
#' # (takes U, f:U -> V to M(f(U)), instead of
#' # U, f:U -> M(V) to M(f(U)))
#' # so similar to a functor taking
#' # f:U -> V to f':M(U) -> M(V)
#' # followed by application.
#' apply_left.recording_value <- function(
#' pipe_left_arg,
#' pipe_right_arg,
#' pipe_environment,
#' left_arg_name,
#' pipe_string,
#' right_arg_name) {
#' force(pipe_environment)
#' tmp <- wrapr::pipe_impl(
#' pipe_left_arg = pipe_left_arg$value,
#' pipe_right_arg = pipe_right_arg,
#' pipe_environment = pipe_environment,
#' pipe_string = pipe_string)
#' unit_recording(
#' tmp,
#' paste0(pipe_left_arg$recording,
#' ' %.>% ',
#' paste(as.expression(pipe_right_arg), collapse = '\n')))
#' }
#'
#' # make available on standard S3 search path
#' assign('apply_left.recording_value',
#' apply_left.recording_value,
#' envir = .GlobalEnv)
#'
#' unpack[value, recording] := 3 %.>%
#' unit_recording(.) %.>%
#' sin(.) %.>%
#' cos(.)
#'
#' print(value)
#' print(recording)
#'
#' # clean up
#' rm(envir = .GlobalEnv, list = 'apply_left.recording_value')
#'
#' @export
#'
pipe_impl <- function(pipe_left_arg,
pipe_right_arg,
pipe_environment,
pipe_string = NULL) {
# make sure environment is available
force(pipe_environment)
# special case: parenthesis
while(is.call(pipe_right_arg) &&
(length(pipe_right_arg)==2) &&
(length(as.character(pipe_right_arg[[1]]))==1) &&
(as.character(pipe_right_arg[[1]])=="(")) {
pipe_right_arg <- pipe_right_arg[[2]]
}
# capture names
left_arg_name <- NULL
if(is.name(pipe_left_arg)) {
left_arg_name <- pipe_left_arg
}
right_arg_name <- NULL
if(is.name(pipe_right_arg)) {
right_arg_name <- pipe_right_arg
}
# special case: name
is_name <- is.name(pipe_right_arg)
# special case: dereference names
qualified_name <- is.call(pipe_right_arg) &&
(length(pipe_right_arg)==3) &&
(length(as.character(pipe_right_arg[[1]]))==1) &&
(as.character(pipe_right_arg[[1]]) %in% c("::", ":::", "$", "[[", "[", "@")) &&
(is.name(pipe_right_arg[[2]])) &&
(as.character(pipe_right_arg[[2]])!=".") &&
(is.name(pipe_right_arg[[3]]) || is.character(pipe_right_arg[[3]])) &&
(as.character(pipe_right_arg[[3]])!=".")
# special case: anonymous funciton decl
is_function_decl <- is.call(pipe_right_arg) &&
(length(as.character(pipe_right_arg[[1]]))==1) &&
(as.character(pipe_right_arg[[1]])=="function")
dot_paren <- FALSE
eager_expression_eval <- FALSE
if(is.call(pipe_right_arg) &&
(length(as.character(pipe_right_arg[[1]]))==1)) {
call_name <- as.character(pipe_right_arg[[1]])[[1]]
if(call_name == ".") {
# special-case .() on RHS
dot_paren <- TRUE
} else {
if(call_name %in% c('[', '[[')) {
# special case [, treat 2nd argument as controller
if(length(pipe_right_arg) >= 2) {
obj_found_name <- as.character(pipe_right_arg[[2]])
if(length(obj_found_name)==1) {
obj_found <- mget(obj_found_name, envir = pipe_environment, mode = "any", inherits=TRUE, ifnotfound = list(NULL))[[1]]
if(!is.null(obj_found)) {
if(isTRUE(attr(obj_found, "dotpipe_eager_eval_bracket"))) {
eager_expression_eval <- TRUE
}
}
}
}
} else {
fn_found <- mget(call_name, envir = pipe_environment, mode = "function", inherits=TRUE, ifnotfound = list(NULL))[[1]]
if(!is.null(fn_found)) {
if(isTRUE(attr(fn_found, "dotpipe_eager_eval_function"))) {
eager_expression_eval <- TRUE
}
}
}
}
}
# check for right-apply situations
if(is.function(pipe_right_arg) ||
is_name || qualified_name ||
is_function_decl || dot_paren || eager_expression_eval) {
if(is_name) {
if(as.character(pipe_right_arg) %in% forbidden_pipe_destination_names) {
stop(paste("to reduce surprising behavior wrapr::pipe does not allow direct piping into some names, such as",
as.character(pipe_right_arg)))
}
pipe_right_arg <- base::get(as.character(pipe_right_arg),
envir = pipe_environment,
mode = "any",
inherits = TRUE)
} else if(qualified_name || is_function_decl) {
pipe_right_arg <- base::eval(pipe_right_arg,
envir = pipe_environment,
enclos = pipe_environment)
} else if(dot_paren) {
pipe_right_arg <- eval(pipe_right_arg[[2]],
envir = pipe_environment,
enclos = pipe_environment)
} else if(eager_expression_eval) {
pipe_right_arg <- eval(pipe_right_arg,
envir = pipe_environment,
enclos = pipe_environment)
}
# pipe_right_arg is now a value (as far as we are concerned)
# special case: functions
if(is.function(pipe_right_arg)) {
if(!is.null(left_arg_name)) {
# try to pass name forward to function
# support NSE in functions, but don't encourage it in expressions
res <- withVisible(do.call(pipe_right_arg,
list(left_arg_name),
envir = pipe_environment))
} else {
# force pipe_left_arg
pipe_left_arg <- eval(pipe_left_arg,
envir = pipe_environment,
enclos = pipe_environment)
res <- withVisible(do.call(pipe_right_arg,
list(pipe_left_arg),
envir = pipe_environment))
}
if(res$visible) {
return(res$value)
} else {
return(invisible(res$value))
}
}
# force pipe_left_arg
pipe_left_arg <- eval(pipe_left_arg,
envir = pipe_environment,
enclos = pipe_environment)
# S3 dispatch on right argument, surrogate function
res <- withVisible(apply_right(pipe_left_arg,
pipe_right_arg,
pipe_environment,
left_arg_name,
pipe_string,
right_arg_name))
if(res$visible) {
return(res$value)
} else {
return(invisible(res$value))
}
}
# force pipe_left_arg
pipe_left_arg <- eval(pipe_left_arg,
envir = pipe_environment,
enclos = pipe_environment)
# Go for standard (first argument) S3 dispatch
res <- withVisible(apply_left(pipe_left_arg,
pipe_right_arg,
pipe_environment,
left_arg_name,
pipe_string,
right_arg_name))
if(res$visible) {
res$value
} else {
invisible(res$value)
}
}
#' Pipe operator ("dot arrow", "dot pipe" or "dot arrow pipe").
#'
#' Defined as roughly : \code{a \%>.\% b} ~ \code{\{ . <- a; b \};}
#' (with visible .-side effects).
#'
#' The pipe operator has a couple of special cases. First: if the right hand side is a name,
#' then we try to de-reference it and apply it as a function or surrogate function.
#'
#' The pipe operator checks for and throws an exception for a number of "piped into
#' nothing cases" such as \code{5 \%.>\% sin()}, many of these checks can be turned
#' off by adding braces.
#'
#' For some discussion, please see \url{https://win-vector.com/2017/07/07/in-praise-of-syntactic-sugar/}.
#' For some more examples, please see the package README \url{https://github.com/WinVector/wrapr}.
#' For formal documentation please see \url{https://github.com/WinVector/wrapr/blob/master/extras/wrapr_pipe.pdf}.
#' For a base-R step-debuggable pipe please try the Bizarro Pipe \url{https://win-vector.com/2017/01/29/using-the-bizarro-pipe-to-debug-magrittr-pipelines-in-r/}.
#' \code{\%>.\%} and \code{\%.>\%} are synonyms.
#'
#' The dot arrow pipe has S3/S4 dispatch (please see \url{https://journal.r-project.org/archive/2018/RJ-2018-042/index.html}).
#' However as the right-hand side of the pipe is normally held unevaluated, we don't know the type except in special
#' cases (such as the rigth-hand side being referred to by a name or variable). To force the evaluation of a pipe term,
#' simply wrap it in .().
#'
#' @param pipe_left_arg left argument expression (substituted into .)
#' @param pipe_right_arg right argument expression (presumably including .)
#' @return eval(\{ . <- pipe_left_arg; pipe_right_arg \};)
#'
#' @examples
#'
#' # both should be equal:
#' cos(exp(sin(4)))
#' 4 %.>% sin(.) %.>% exp(.) %.>% cos(.)
#'
#' f <- function() { sin }
#' # returns f() ignoring dot, not what we want
#' 5 %.>% f()
#' # evaluates f() early then evaluates result with .-substitution rules
#' 5 %.>% .(f())
#'
#' @name dot_arrow
NULL
#' @describeIn dot_arrow dot arrow
#' @export
`%.>%` <- function(pipe_left_arg, pipe_right_arg) {
pipe_left_arg <- substitute(pipe_left_arg)
pipe_right_arg <- substitute(pipe_right_arg)
pipe_environment <- parent.frame()
pipe_string <- as.character(sys.call()[[1]])
pipe_impl(pipe_left_arg, pipe_right_arg,
pipe_environment, pipe_string)
}
#' @describeIn dot_arrow alias for dot arrow
#' @export
`%>.%` <- function(pipe_left_arg, pipe_right_arg) {
pipe_left_arg <- substitute(pipe_left_arg)
pipe_right_arg <- substitute(pipe_right_arg)
pipe_environment <- parent.frame()
pipe_string <- as.character(sys.call()[[1]])
pipe_impl(pipe_left_arg, pipe_right_arg,
pipe_environment, pipe_string)
}
#' @describeIn dot_arrow alias for dot arrow
#' @export
`%.%` <- function(pipe_left_arg, pipe_right_arg) {
pipe_left_arg <- substitute(pipe_left_arg)
pipe_right_arg <- substitute(pipe_right_arg)
pipe_environment <- parent.frame()
pipe_string <- as.character(sys.call()[[1]])
pipe_impl(pipe_left_arg, pipe_right_arg,
pipe_environment, pipe_string)
}