testwhat icon indicating copy to clipboard operation
testwhat copied to clipboard

Add way to test [, [[ and $

Open filipsch opened this issue 8 years ago • 3 comments

Need a function to test the operators that extract stuff from data structures

filipsch avatar Jun 23 '16 12:06 filipsch

Just a note, operators like this are just normal functions, and can be referred to using backticks..

`<-`('a', 1)
a  # prints 1

`if`(a == 1, print('one'), print('boo')) # prints one

# indexing
b = 1:10
`[`(b, 2)

# same thing but using get
get("[")(b, 2)

@filipsch any sense for how much modifying test_function would need to handle this? If it's using anything like get("[")(b, 2), then it should be pretty smooth sailing...

machow avatar Nov 17 '16 22:11 machow

@machow I'm afraid that getParseData() doesn't see them as 'just functions', but I'd have to dive more deeply to answer your question in a satisfying way.

filipsch avatar Nov 18 '16 09:11 filipsch

This would be very doable with a refactor to use the as.expression "ast". Would probably require major changes and a week or two of work, though.

machow avatar May 22 '17 15:05 machow