diff --git a/10_Expressions/Andrew_exper.Rmd b/10_Expressions/Andrew_exper.Rmd index 3e1d743..a9faa12 100644 --- a/10_Expressions/Andrew_exper.Rmd +++ b/10_Expressions/Andrew_exper.Rmd @@ -17,6 +17,7 @@ is.constant() is.elem <- function(x){ testers <- c(is.call, is.name, is.pairlist, is.atomic) tested <- vapply(testers, function(f) f(x), FUN.VALUE = TRUE) + if(is.atomic(x) & length(x) > 1) stop("Atomic vectors cannot have length larger than one in an expression.") any(tested) } @@ -236,4 +237,4 @@ arguements are matched by position ### Read the documentation and source code for pryr::partial(). What does it do? How does it work? Read the documentation and source code for pryr::unenclose(). What does it do and how does it work? -### The actual implementation of curve() looks more like \ No newline at end of file +### The actual implementation of curve() looks more like