egnha / valaddin

Functional input validation to make R functions more readable and robust
Other
33 stars 1 forks source link

%firmly% #21

Closed egnha closed 7 years ago

egnha commented 7 years ago

Cf. #19

An operator to provide alternative semantics for check specification (idea due to @MilkWasABadChoice):

`%firmly%` <- function(.checklist, .f) firmly(.f, .checklist = .checklist)

Example:

vec_add <- list(
  ~is.numeric, vld_true(~length(a) == length(b))
) %firmly% 
  function(a, b) {
    a + b
  }