Skip to content

code_feedback() should ignore argument names of anonymous functions #287

Open

Description

@rossellhayes

code_feedback() alerts the user to differences in the argument names of anonymous functions. Is it possible to ignore this?

library(gradethis)

.user_code     <- "map(data, function(x) is.na(x))"
.solution_code <- "map(data, function(y) is.na(y))"

code_feedback()
#> In `function(x)`, I expected argument `y` where you wrote argument `x`.

Created on 2022-02-16 by the reprex package (v2.0.1)

Activity

  1. added
    grade code
    on Feb 16, 2022
  2. gadenbuie commented on Feb 16, 2022

    @gadenbuie
    Member

    Even worse

    .user_code     <- "map(data, function(x) is.na(x))"
    .solution_code <- "map(data, ~ is.na(.x))"
    
    code_feedback()
    #> In `map(data, function(x) is.na(x))`, I expected you to call ``~`()` where you called `function() NULL`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

grade code

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions