-
-
Notifications
You must be signed in to change notification settings - Fork 41
Description
Having completed all the core exercises and most of the side exercises on the R track, it's become clear to me that while Exercisms testing model works well enough for general-purpose languages, it breaks down for languages that do things a little differently like R. The general design of the tests is that they assume that the student is going to produce a function that accepts a single value. To test several input values, the student's function is called several times with different single values.
This works fine for a general-purpose language like Python or JavaScript, but it breaks down for R which has no concept of single values. Instead, a declaration like x <- 1
does not create an integer or number value, but a numeric vector of size 1. This is a very important concept in R and one that needs to be emphasised to students of the language. I didn't have a firm grasp of this concept myself until recently, despite using R in a professional capacity for some time. Unfortunately the unit tests as they stand don't require the student to "think in R" and allow them to assume that the input values are single-element vectors. I've come to realise while working through the track that I've been guilty of this myself.
The solution to this is quite straightforward: in each exercise, in addition to the current tests, there should be one final test that takes all the values from the previous tests, combines them into a vector (or list, if appropriate) and sends that vector or list to the students function. This will check if they've made the mistake of assuming that the input is a single value, or if they've respected the R way of doing things. This may well break existing solutions (including most of mine), but I think it's a change worth making.
I'm happy to submit the PR's for this myself, but I'd like to see if you agree with my observations and think this is worth doing first.