General FizzBuzz: Difference between revisions
→Names solution: Added syntactic sugar.
(OCaml implementation) |
ReeceGoding (talk | contribs) (→Names solution: Added syntactic sugar.) |
||
Line 2,881:
===Names solution===
If we deviate from the task's example of how to input parameters and instead use R's names
<lang r>namedGenFizzBuzz<-function(n,namedNums)
{
Line 2,892:
invisible()
}
namedNums<-c(Fizz=3,Buzz=5,Baxx=7)#Notice that we can name our inputs without a call to names
namedGenFizzBuzz(105,namedNums)
shuffledNamedNums<-c(Buzz=5,Prax=9,Fizz=3,Baxx=7
namedGenFizzBuzz(105,shuffledNamedNums)</lang>
|