R: Length from scratch
r_length <- function(x) { out <- 0L for (i in x) { out <- out + 1L } out } r_vector <- 1:20 r_length(r_vector) #> [1] 20