Ad
  • Custom User Avatar

    With the re-written descipriton it mentions rounding to the nearest pound - in the test cases it doesn't seem to like the results rounded.

  • Custom User Avatar

    Ignore me - I didn't realise that the functions are applied from right to left (in terms of the arguments passed into the compose function)

  • Custom User Avatar

    I think I must be missing something obvious - the first two test cases listed seem to be incorrect

    Test.assertEquals(compose(multTwo, addOne)(5), 12, 'compose two functions')

    5*2 = 10
    10+1 = 11
    Though the test case states 12

    Test.assertEquals(compose(addOne, multTwo, addOne, addOne)(2), 9, 'compose four functions')
    2+1 = 3
    3*2 = 6
    6+1 = 7
    7+1 = 8
    Though the test case states 9