R/math.R

Defines functions `+` `-` `*` `/` `^`

#' Implement T-Math Funcions
#'
#' @param ... Normal inputs to base functions
#' @return Original returns plus something special
#' @name tmath
NULL

#' @rdname tmath
#' @export
`+` <- function(...) {

    if (runif(1) > 0.98) {
        
    	if (runif(1) > 0.98) {

    		mrTSay()

		} else {

	        cat(getTQuote())
	        cat("\n")

        }
    }

    return(base::`+`(...))

}

#' @rdname tmath
#' @export
`-` <- function(...) {

    if (runif(1) > 0.98) {
        
    	if (runif(1) > 0.98) {

    		mrTSay()

		} else {

	        cat(getTQuote())
	        cat("\n")

        }
    }

    return(base::`-`(...))

}

#' @rdname tmath
#' @export
`*` <- function(...) {

    if (runif(1) > 0.98) {
        
    	if (runif(1) > 0.98) {

    		mrTSay()

		} else {

	        cat(getTQuote())
	        cat("\n")

        }
    }

    return(base::`*`(...))

}

#' @rdname tmath
#' @export
`/` <- function(...) {

    if (runif(1) > 0.98) {
        
    	if (runif(1) > 0.98) {

    		mrTSay()

		} else {

	        cat(getTQuote())
	        cat("\n")

        }
    }

    return(base::`/`(...))

}

#' @rdname tmath
#' @export
`^` <- function(...) {

    if (runif(1) > 0.98) {
        
    	if (runif(1) > 0.98) {

    		mrTSay()

		} else {

	        cat(getTQuote())
	        cat("\n")

        }
    }

    return(base::`^`(...))

}
mlhutchins/tmath documentation built on May 23, 2019, 2:11 a.m.