singleword_valid(sample(1:9)) # TRUE
singleword_valid(c(3L,4L,2L,1L)) # TRUE
singleword_valid(c(3,4,2,1)) # FALSE (not integer)
singleword_valid(c(3L,3L,2L,1L)) # FALSE (3 repeated)
cyclist_valid(list(c(1,8,2),c(3,6))) # TRUE
cyclist_valid(list(c(1,8,2),c(3,6))) # FALSE ('8' is repeated)
cyclist_valid(list(c(1,8,1),c(3,6))) # FALSE ('1' is repeated)
cyclist_valid(list(c(0,8,2),c(3,6))) # FALSE (zero element)
Run the code above in your browser using DataLab