Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix unit tests and example for Collatz Conjecture
As a demonstration of the point I raised in issue exercism#109, here is an update for the non-core Collatz Conjecture exercise. The current version of this does not test for vector parameters and the example would fail this test. The following changes have been made: - An extra test has been added to the unit tests that send a four-element vector to the function. - In the example, he original function `collatz_step_counter` has been renamed to `collatz_scalar`. - Also in the example, the line `collatz_step_counter <- Vectorize(collatz_scalar)` has been added. This is a very minor change to the example, but makes the function a lot more powerful by taking full advantage of R's vectorisation capabilities. R developers really shouldn't be thinking in single values the way most mainstream programming languages do.
- Loading branch information