Is tacit programming possible in the statistical programming language R? -


is tacit programming known point-free style - option in r?

check magrittr package since seems closest asking. wikipedia quotes example:

for example, sequence of operations in applicative language following:

def example(x):    y = foo(x)    z = bar(y)    w = baz(z)    return w 

...is written in point-free style composition of sequence of functions, without parameters:

def example: baz bar foo

in r magrittr written as

x %>% foo %>% bar %>% baz 

where %>% operator used compose chain of functions, output of previous function passed first argument of subsequent function. see magrittr vignette learning more.

the function defined

# explicitly example <- function(x) x %>% foo %>% bar %>% baz  # or (as @bergant noticed) example <- . %>% foo %>% bar %>% baz 

Comments