Closed dtkaplan closed 6 years ago
Hi Daniel. The branch is there: https://github.com/tidyverse/rlang/pull/270
I'll try to get it merged soon but you can install it with install_github("lionel-/rlang", ref = "utils-redpen")
in the meantime.
Thanks!
I'm running into some problems with named wildcards.
Here's a segment from your test cases:
test_that("can match and bind on tag", {
x <- quote(lang(tag = bar))
expect_identical(node_match(x, lang(`.(foo)` = bar) := toupper(foo)), "TAG")
})
This fails, as do all the other match-and-bind examples, with an error of
Error: !length(data) || is_named(data) is not TRUE
I can get things working if I modify your node_match.R
like this:
push_binding <- function(pattern, input, env, bindings) {
binding <- node_cadr(pattern)
if (!is_symbol(binding)) {
abort("Binding must be a symbol")
}
if (is_eval_operator(pattern)) {
value <- eval_bare(input, env)
} else {
value <- input
}
danny_version <- function(.env, ...) {
components <- list(...)
the_named_list <- components[2]
names(the_named_list) <- components[1]
invisible(rlang:::env_bind_impl(.env, the_named_list))
}
danny_version(bindings, as_string(binding), value)
# instead of ...
# env_poke(bindings, as_string(binding), value)
}
I have such a tentative grasp on rlang
that I can't believe this is an actual solution, but I wonder if this might help you figure out either (1) what I'm misunderstanding in running the test cases or (2) why the test cases are failing.
Hi Daniel, I have just rebased https://github.com/tidyverse/rlang/pull/270, could you reinstall it and try again please? The redpen tests pass on my machine.
I have now finished reimplementing dots capture in C so I'll take some time on redpen next week. We just need to discuss the new pattern capture functions with Hadley then we can merge the PRs to master.
Thanks. That's working well enough for me to move forward.
On Fri, Nov 24, 2017 at 10:41 AM Lionel Henry notifications@github.com wrote:
Hi Daniel, I have just rebased tidyverse/rlang#270 https://github.com/tidyverse/rlang/pull/270, could you reinstall it and try again please? The redpen tests pass on my machine.
I have now finished reimplementing dots capture in C so I'll take some time on redpen next week. We just need to discuss the new pattern capture functions with Hadley then we can merge the PRs to master.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/lionel-/redpen/issues/2#issuecomment-346866295, or mute the thread https://github.com/notifications/unsubscribe-auth/AAggraymlVCAtPYcfngJBGQcHAu5Q4cBks5s5vGOgaJpZM4QmwRW .
Per suggestion of @garrettgman I'm looking at your redpen package as a potential basis for a revision of my checkr package for checking learnr exercises. It uses some functions (e.g.
fn_swap()
,node_list_along()
,dots_patterns()
, and likely others) which I'm guessing come from earlier versions ofrlang
, but I can't find them in the github commit history.Could you direct me to the sources for these functions?