简体   繁体   中英

What's the R equivalent of progn in 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)))

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)})

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM