Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the R equivalent of progn in lisp?

Tags:

r

lisp

In lisp there is syntax to execute several expressions in sequence within function arguments. Given R's lispy origins, I'm wondering is there an equivalent feature in R? I'm imagining writing something like the following:

with(heat,
     do(qqnorm(loss), qqline(loss)))
like image 971
wdkrnls Avatar asked Sep 29 '22 17:09

wdkrnls


1 Answers

In R, brackets are used to group multiple statements in a "compound statement", which appears to be the role played by progn in Lisp. As with progn, all of the component statements are evaluated, but only the value of the final statement is returned.

with(mtcars, 
     {qqnorm(mpg); qqline(mpg)})
like image 176
Josh O'Brien Avatar answered Oct 01 '22 07:10

Josh O'Brien