简体   繁体   中英

How are expression objects (EXPRSXP) used in R?

I was wondering how expression objects (EXPRSXP) are used in R? It seems to me that R almost always using call objects to carry out the language computation. Any one could point to me some places that expression objects are used instead of call objects?

Another side question... for three points in a promise, does the third pointer pointing to an call object (LANGSXP) or an expression object (EXPRSXP)?

Thanks, Shen

The return value of parse is an expression, so this would be a common use case for expressions (I've used expressions a fair bit in this type of context).

str(parse(text="1 + 1\n2+2"))
# length 2 expression(1 + 1, 2 + 2)

Promises are documented as containing expressions , though in most cases presumably they would be 1 length expressions, so effectively a call/symbol, though probably still stored as an expression (I'm speculating here).

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