Adds solution_eval_fn to gradethis_exercise_checker(), which takes a function with two arguments:
function(code, envir) {
# evaluate the solution `code`
# within `envir` or using objects gathered from `envir`
# where `envir` is basically `envir_prep` from learnr
}
This function can be passed directly to gradethis_exercise_checker() but more often than not, you'd want to register the solution evaluation function for a specific exercise engine by providing a named list to the option gradethis.exercise_checker.solution_eval_fn, e.g.
This powers .solution and .solution_all out of the box. If the solution evaluation function needs to protect against missing solution code, it can throw an error with rlang::abort(class = "error_missing_solution") to signal that no solution was provided. (This is used, for example, if parse(text = code) returns no expressions in R.)
Adds
solution_eval_fn
togradethis_exercise_checker()
, which takes a function with two arguments:This function can be passed directly to
gradethis_exercise_checker()
but more often than not, you'd want to register the solution evaluation function for a specific exercise engine by providing a named list to the optiongradethis.exercise_checker.solution_eval_fn
, e.g.This powers
.solution
and.solution_all
out of the box. If the solution evaluation function needs to protect against missing solution code, it can throw an error withrlang::abort(class = "error_missing_solution")
to signal that no solution was provided. (This is used, for example, ifparse(text = code)
returns no expressions in R.)